本文へスキップ
Skillpedia
一般的なプログラミング6.6k · #13802

physics-tuning

できること

ゲームの物理を安定して手応えのあるものにする、一般的な設定を説明します。オブジェクトが震えたり、壁をすり抜けたり、ふわふわ浮いたりするゲーム開発者向けです。

使う場面

  • ✓静止しているはずのオブジェクトが、震えたり揺れたりするとき。
  • ✓速いオブジェクトが壁をすり抜けるとき(トンネリングと呼ばれます)。
  • ✓重力、質量、抵抗、衝突レイヤーを設定して、動きを正しく感じさせたいとき。

スキルのリンク

https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/physics-tuning/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/physics-tuning/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“速い弾が薄い壁をすり抜け、積まれた箱が震えます。物理の設定を調整してもらえますか。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、物理の処理を固定のタイムステップに移し、描画する位置をステップの間で補間し、速いオブジェクトには連続衝突検出をオンにします。また、震えを止めるために、質量、抵抗、衝突レイヤーを調整します。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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

  1. 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.
  2. 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.
  3. 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.
  4. Tune the body, not the scene. Set mass for relative weight, drag for damping, gravity scale per object, and restitution/friction via materials.
  5. Stop tunneling with CCD on small/fast bodies; cap maximum velocity.
  6. Stabilize stacks/joints with more solver iterations, sane mass ratios, and sleeping for resting bodies.
  7. 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

# Physics callback: runs at the FIXED rate. Use its dt for all integration.
func _physics_process(dt):                  # Unity: void FixedUpdate()
    velocity += gravity * dt                # integrate with the FIXED dt
    move_and_slide()                        # engine resolves collisions this step
    _prev_pos = _curr_pos; _curr_pos = global_position   # record for interpolation

# Render frame: runs as fast as the display. Interpolate between physics states.
func _process(_frame_dt):                   # Unity: void Update()
    var alpha = Engine.get_physics_interpolation_fraction()  # 0..1 within the tick
    visual.global_position = _prev_pos.lerp(_curr_pos, alpha)
# RIGHT: integrate in the fixed step, render via interpolation.
# WRONG: applying forces in _process/Update with frame dt — speed and collisions
# then depend on frame rate and jitter under load.

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

# Fast, small bodies skip past thin colliders between ticks. Two fixes:
body.continuous_cd = true            # RigidBody3D bool (RigidBody2D: CCD_MODE_* enum)
# Unity: rb.collisionDetectionMode = CollisionDetectionMode.ContinuousSpeculative (cheap, covers
# dynamic bodies too) or ContinuousDynamic (fast vs fast); plain Continuous sweeps vs static only.
# Cap velocity so a single step can't move more than ~one collider thickness.
const MAX_SPEED := 40.0
if velocity.length() > MAX_SPEED:
    velocity = velocity.normalized() * MAX_SPEED
# Rule of thumb: max_distance_per_step (= speed / physics_hz) should be < the
# thinnest wall. Raise physics_hz or enable CCD when that fails.

3. Body tuning: mass, drag, gravity scale, material

# Mass is RELATIVE weight in collisions; it does NOT change fall speed (gravity
# accelerates all masses equally). Use drag and gravity
よくある質問

なぜ固定のタイムステップを使うのですか?

スキルによると、一定の物理のステップはシミュレーションを安定させ、変動するステップは衝突を一貫しないものにするからです。

連続衝突検出とは何ですか?

速いオブジェクトが薄い壁をすり抜けるのを防ぐ方法です。

ジャンプの感触も扱いますか?

コヨーテタイムのようなジャンプの補助は、入力とコントローラーの話題で、入力のスキルが扱います。

詳細

作者による元の説明

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.

repo: gamedev-skills/awesome-gamedev-agent-skills

人気

GitHubのスター
6.6k
ランキング
#13802
ライセンス
Apache-2.0
更新日
2026/10/28

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル