npx skills add ...
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-physics
Set up 3D physics in Unity 6.3 LTS: Rigidbody movement and forces, colliders, triggers vs collisions, layer-based collision, raycasts, and joints. Use when adding a Rigidbody, handling OnCollisionEnter/OnTriggerEnter, tuning collision layers, casting rays, or when the user mentions Unity physics, AddForce, isKinematic, or linearVelocity.
npx skills add gamedev-skills/awesome-gamedev-agent-skills --skill unity-physics
Make objects move, collide, and detect each other with Unity 6.3 LTS's built-in 3D physics
(PhysX). Get the FixedUpdate discipline, trigger-vs-collision rules, and collision layers
right. Targets Unity 6.3 LTS (6000.3).
Unity 6.3 LTS rename:
Rigidbody.velocityis nowRigidbody.linearVelocity(the old name is deprecated). Code copied from older tutorials will warn or fail to compile.
Rigidbody + Collider components.When not to use: 2D physics (Rigidbody2D, Collider2D) is a separate API — adapt the
concepts but the types differ. Cross-engine feel tuning (timestep, jitter, tunnelling) →
physics-tuning. Reading input that drives movement → unity-input-system.
Rigidbody to anything that should be simulated; add a Collider to anything
that should be hit. A collision needs a Collider on both, and at least one Rigidbody.FixedUpdate. Read input in Update, store intent, then apply
forces / set linearVelocity / call MovePosition in FixedUpdate.AddForce,
linearVelocity, or MovePosition — never assign transform.position to a non-kinematic
Rigidbody (it teleports and breaks collision resolution).OnCollisionEnter; a
Collider with Is Trigger checked passes through and calls OnTriggerEnter.FixedUpdate (with a speed clamp)ForceMode: Force (continuous, mass-scaled), Acceleration (continuous, ignores mass),
Impulse (instant, mass-scaled — jumps), VelocityChange (instant, ignores mass).
Rigidbody.velocity doesn't exist in Unity 6.3 LTS — use linearVelocity (and
angularVelocity is unchanged).transform.position on a dynamic Rigidbody — teleports it, skips collision.
Use MovePosition (kinematic/interpolated) or apply forces.Update — frame-rate-dependent and jittery. Physics goes in
FixedUpdate.Rigidbody on at least one of the two
colliders, and both colliders enabled; two static triggers don't report overlaps.Continuous (or Continuous Dynamic) for bullets/fast movers.MeshColliders or scaled colliders misbehave; prefer primitive
colliders and keep scale uniform.SphereCast, RaycastAll, OverlapSphere, LayerMask bit math) and
joints (FixedJoint, HingeJoint, ConfigurableJoint, breakable joints), read
references/raycasting-and-joints.md.ScriptReference/Rigidbody,
ScriptReference/Physics.Raycast.physics-tuning — engine-agnostic feel: fixed timestep, mass/drag, CCD, stability.unity-csharp-scripting — the FixedUpdate/Update split these patterns rely on.unity-navmesh — agent movement that is not force-driven.// Solid hit: both have colliders, this one has a (non-kinematic) Rigidbody.
private void OnCollisionEnter(Collision col)
{
Debug.Log($"Hit {col.gameObject.name} at {col.contacts[0].point}");
}
// Overlap: one collider has 'Is Trigger' = true. Requires a Rigidbody on at least one party.
private void OnTriggerEnter(Collider other)
{
if (other.CompareTag("Pickup")) Destroy(other.gameObject);
}[SerializeField] private LayerMask groundMask; // set to your "Ground" layer in the Inspector
private bool IsGrounded()
{
// Cast a short ray down; only test colliders on groundMask.
return Physics.Raycast(transform.position, Vector3.down, out RaycastHit hit,
1.1f, groundMask);
}// isKinematic Rigidbody: not driven by forces, but MovePosition interpolates and carries
// resting bodies correctly (unlike moving the Transform directly).
private void FixedUpdate() => _rb.MovePosition(_rb.position + Vector3.right * (2f * Time.fixedDeltaTime));