junmystery/agent-guidance-rust/physics-tuning
Claude Code and agent skill by junmystery/agent-guidance-rust
- community
Checking that the SKILL.md file is still in the repository.
Tune game physics for stable, good-feeling motion — fixed vs variable timestep, render interpolation, mass/gravity/drag, continuous collision detection (CCD) to stop tunneling, fixing jitter, and collision layers/masks. Engine-neutral. Use when the user mentions physics feel, jitter, tunneling, fixed timestep, FixedUpdate, CCD, bouncing/unstable physics, or collision layers.
Install
npx vskill@latest install junmystery/agent-guidance-rust/physics-tuningSKILL.md
The same SKILL.md was published earlier as gamedev-skills/awesome-gamedev-agent-skills/physics-tuning.
Physics tuning
Most "bad physics" is not a bug in the engine — it's a mismatch between the fixed-timestep simulation and the variable-rate render loop, or untuned mass/drag/CCD/layer settings. This skill covers the engine-neutral knobs that make physics stable and responsive; pair it with godot-physics or unity-physics for the concrete APIs.
When to use
- Use when motion jitters, objects pass through walls (tunneling), stacks
explode, or movement feels floaty/sticky/laggy.
- Use to decide what goes in the fixed (physics) step vs the render frame, and
how to interpolate between them.
- Use to tune gravity, mass, drag, restitution, solver iterations, sleeping, and
collision layers/masks.
When *not* to use: for an engine's exact physics nodes/components and collision callbacks, use godot-physics or unity-physics. For movement decisions (when to jump, AI steering) use input-systems and game-ai. For platformer jump-feel specifics like coyote time/jump buffering, that's input/ controller territory — see input-systems and the platformer genre.
Core workflow
- Run physics on a fixed timestep. Simulate at a constant rate (e.g. 50–60
Hz). A fixed dt makes the simulation deterministic-ish and stable; a variable dt makes integration and collisions inconsistent.
- Put physics work in the physics callback, not the render frame. Apply
forces/velocities and read collisions in the fixed step (FixedUpdate / _physics_process), using that step's dt.
- Interpolate rendering between physics ticks. The render frame rate ≠ the
physics rate, so smoothly interpolate transforms toward the latest physics state, or enable the engine's Rigidbody interpolation, to remove visible stutter.
- Tune the body, not the scene. Set mass for relative weight, drag for
damping, gravity scale per object, and restitution/friction via materials.
- Stop tunneling with CCD on small/fast bodies; cap maximum velocity.
- Stabilize stacks/joints with more solver iterations, sane mass ratios, and
sleeping for resting bodies.
- Verify by feel and stress test. Play at low and high frame rates; throw
fast objects at thin walls; stack and shove bodies. Report what you observed.
Patterns
1. Fixed timestep for simulation, render interpolation for smoothness
Most engines offer this for you: Godot's project setting physics/common/physics_interpolation (off by default; it interpolates every node, 2D and 3D) and Unity's Rigidbody.interpolation = Interpolate. Prefer the built-in before hand-rolling, and never do both on the same node.
2. Stop tunneling: CCD + a speed cap
3. Body tuning: mass, drag, gravity scale, material
4. Collision layers and masks (who collides with whom)
Pitfalls
- Applying forces/movement in the render frame (
Update/_process) makes
behavior frame-rate dependent — faster PCs run faster, and collisions get flaky. Do simulation in the fixed step.
- Visible jitter even with a fixed step usually means no render
interpolation: the physics rate and display rate beat against each other. Enable interpolation.
- Tunneling through thin walls: discrete collision misses fast movers. Enable
CCD, cap speed, thicken walls, or raise the physics rate.
- Expecting heavier objects to fall faster. Gravity is acceleration; mass
affects collision response, not fall speed. Use gravity_scale/drag for feel.
- Exploding stacks / jittery joints: mass ratios too extreme, or too few
solver iterations. Keep mass ratios modest and raise iteration counts.
- Bodies that never rest burn CPU and twitch. Enable sleeping and a sensible
sleep threshold for resting objects.
- One-directional layer setup: A's mask includes B but B's mask excludes A.
Detection/collision can need both sides; verify the full matrix.
- Huge `dt` spikes (load hitches, breakpoints) blow up integration. Clamp the
max physics step / substep count so a stall doesn't launch everything (Godot physics/common/max_physics_steps_per_frame, Unity Maximum Allowed Timestep).
- Teleports smear across the screen with interpolation on: the renderer
blends from the old position. Godot: call reset_physics_interpolation() after moving the node. Unity: move interpolated bodies through the Rigidbody; a direct transform write is ignored unless followed by Physics.SyncTransforms().
- Feel changes after raising the physics rate: Godot (GodotPhysics and Jolt
alike) damps by multiplying velocity by 1 - damp / ticks_per_second each tick, an approximation that drifts as damp approaches the tick rate (at damp >= ticks_per_second the body stops in one tick). Small damping values barely change; re-tune large ones after changing physics_ticks_per_second.
References
references/timestep-and-ccd.md— the fixed-timestep accumulator loop,
interpolation math, substepping, CCD modes, solver/iteration tuning, sleeping, and a stability checklist.
Related skills
godot-physics,unity-physics— concrete bodies, colliders, and callbacks.input-systems— responsive controls, jump buffering, coyote time.game-ai— agent movement that must agree with the physics step.platformer,fps-shooter— genres whose feel depends on this tuning.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/physics-tuning/SKILL.md
Popularity
- 7-day trend score
- 5
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/junmystery/agent-guidance-rust/physics-tuning)