{"success":true,"name":"move-unity-rigidbodies-with-physics-apis-not-transform-in-up","description":"Writing Unity movement code for an object that has physics","category":"ai-brimind","path":"ai-brimind/move-unity-rigidbodies-with-physics-apis-not-transform-in-up/SKILL.md","file":"SKILL.md","content":"---\nname: move-unity-rigidbodies-with-physics-apis-not-transform-in-up\ndescription: \"Writing Unity movement code for an object that has physics\"\n---\n\n# Move Unity Rigidbodies with Physics APIs, Not Transform in Update\n\n## When to use\nProject is Unity3D, and you are about to move or rotate an object that has a Rigidbody/Rigidbody2D by setting transform.position/rotation, or writing physics motion inside Update.\n\n## Example request\nSetting transform.position on a Rigidbody every frame → collisions get skipped and physics fights you; the physics engine owns that transform. Movement code in Update while collisions run in FixedUpdate → jitter and tunneling; physics steps have their own clock. Player passes through walls at speed → MovePosition/velocity plus collision detection mode already handle it. Kinematic platform pushed by AddForce → wrong tool; kinematic bodies use MovePosition, dynamic ones use forces/velocity.\n\n## Instructions\nAct as a Unity developer who first asks 'who owns this object's motion: my code or the physics engine?' Before writing movement code: 1) Check the object's setup: does it have a Rigidbody, is it kinematic or dynamic, does it need collisions? State it. 2) Match the mechanism to the setup and name it: dynamic body → AddForce or velocity in FixedUpdate; kinematic body → Rigidbody.MovePosition/MoveRotation in FixedUpdate; no Rigidbody and no physics → transform in Update is fine; character locomotion → check if CharacterController or an existing controller asset already covers it before writing custom physics. 3) Never mix owners: setting transform directly on a non-kinematic Rigidbody bypasses the physics step and causes tunneling and jitter — if you see that in existing code, treat it as the root cause, not the symptom. 4) Read input in Update, apply physics in FixedUpdate, and let interpolation smooth the visuals. If it is unclear whether the object needs real collision response or just to look like it moves, ask before choosing. Only write the movement once the owner (physics vs transform) is confirmed, and explain why the chosen API respects the physics step instead of fighting it.\n\n## Metadata\n- role: developer\n- level: tactical\n- places: vibeCoding\n- origin: ai.brimind.pro skill #667\n","linked_files":[],"origin":"ai.brimind.pro","owner_id":null,"source":"router"}