unity-physics-anim
Unity 3D physics (Rigidbody, Collider, Joints) and animation (Animator state machines, parameters, layers, Animation Rigging, Humanoid retargeting, blend trees). USE WHEN: tuning rigidbody movement, designing Animator state machines, blending animations, layer collision matrix, joints/constraints, motion warping, IK setups. DO NOT USE FOR: 2D physics or 2D animation (use `unity-2d-physics` / `unity-2d-animation`); ECS physics (use `unity-dots`).
What this skill does
# Unity Physics & Animation (3D)
## Rigidbody fundamentals
```csharp
[RequireComponent(typeof(Rigidbody))]
public class CharacterMover : MonoBehaviour {
[SerializeField] private float moveSpeed = 6f;
[SerializeField] private float jumpVelocity = 8f;
private Rigidbody _rb;
private Vector2 _input;
private bool _jumpQueued;
private void Awake() {
_rb = GetComponent<Rigidbody>();
_rb.interpolation = RigidbodyInterpolation.Interpolate; // smooth visual
_rb.collisionDetectionMode = CollisionDetectionMode.Continuous;
}
public void SetInput(Vector2 i) => _input = i;
public void Jump() => _jumpQueued = true;
private void FixedUpdate() {
Vector3 vel = _rb.linearVelocity;
Vector3 target = new Vector3(_input.x, 0, _input.y) * moveSpeed;
vel.x = target.x; vel.z = target.z;
if (_jumpQueued) { vel.y = jumpVelocity; _jumpQueued = false; }
_rb.linearVelocity = vel;
}
}
```
Note: in Unity 6 it's `linearVelocity` (not `velocity`).
## Layer collision matrix
Edit > Project Settings > Physics > Layer Collision Matrix. Default — too permissive. Cull pairs you don't need (Player/PlayerProjectile, Enemy/EnemyProjectile) for both correctness and perf.
## Joints
| Joint | Use |
|---|---|
| Hinge | Doors, swinging objects |
| Configurable | Custom freedom — vehicles, ragdolls |
| Spring | Soft-body-like bouncy connections |
| Fixed | Two rigidbodies behaving as one (breakable) |
## Animator state machine
```
[Idle] --(Speed > 0.1)--> [Run]
[Run] --(Speed < 0.1)--> [Idle]
[Run] --(Jump trigger)-> [Jump] --(Grounded && Vel<0)--> [Land] --> [Idle]
```
Parameters: `float Speed`, `bool Grounded`, `trigger Jump`. **Cache hashes**:
```csharp
private static readonly int SpeedHash = Animator.StringToHash("Speed");
private static readonly int JumpHash = Animator.StringToHash("Jump");
void Update() => _animator.SetFloat(SpeedHash, _input.magnitude);
void OnJump() => _animator.SetTrigger(JumpHash);
```
## Animator layers + masks
Upper-body shooting layer over base locomotion: layer with weight 1, Avatar Mask covering only spine/arms, Override blending mode.
## Animation Rigging
Use for procedural pose adjustments without breaking animation: Two-Bone IK (hand to weapon), Multi-Aim Constraint (head looks at target), Damped Transform (cloth-like trailing).
Rig builds at runtime via `RigBuilder` — animations evaluate first, then rig constraints adjust.
## Humanoid retargeting
Map any FBX with similar skeleton to Mecanim Humanoid → animations swap across characters automatically. Generic rig only when humanoid mapping doesn't fit (quadrupeds, robots).
## Anti-patterns
| Anti-pattern | Fix |
|---|---|
| `transform.position` writes for Rigidbody object | `rb.MovePosition` / set linearVelocity in FixedUpdate |
| `Update` for physics input | FixedUpdate for physics writes; Update for input sampling + jump-queue flags |
| String parameter names every frame | Cache `Animator.StringToHash` ints |
| Many Animator transitions w/ no exit time | Set `Has Exit Time = false` + Transition Duration = 0 for snappy combat |
| Heavy IK on every character every frame | Disable RigBuilder when off-screen / culled |
## Production checklist
- [ ] Layer collision matrix culled
- [ ] Rigidbody interpolation set on player + camera-tracked objects
- [ ] Continuous collision on fast-moving bodies
- [ ] Animator parameters use cached hashes
- [ ] Humanoid avatars share animations across characters
- [ ] Rig constraints disabled when not visible
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.