Langsung ke konten
Skillpedia
Pemrograman umum6.6k ยท #13802

physics-tuning

Fungsinya

Skill ini menjelaskan pengaturan umum yang membuat fisika game terasa stabil dan responsif. Skill ini ditujukan untuk pengembang game yang objeknya bergetar, menembus dinding, atau terasa melayang.

Kapan dipakai

  • โœ“Saat objek bergetar atau bergoyang ketika seharusnya diam.
  • โœ“Saat objek cepat menembus dinding, yang disebut tunneling.
  • โœ“Saat Anda perlu mengatur gravitasi, massa, hambatan, atau layer tabrakan agar gerakan terasa benar.

Link skill

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

Salin lalu tempelkan ke AI Anda (Claude, ChatGPT, atau Cursor) dan minta AI mengikuti instruksinya.

Cara pakai

Cara paling mudah: salin pesan ini dan tempelkan ke AI Anda. AI akan membaca skill dan mengikuti instruksinya.

Pesan siap tempel

Gunakan skill ini untuk membantu saya: https://github.com/gamedev-skills/awesome-gamedev-agent-skills/blob/main/skills/disciplines/physics-tuning/SKILL.md Baca file SKILL.md di link tersebut dan ikuti instruksinya untuk tugas saya.
Mau AI Anda menemukan skill seperti ini sendiri?Pasang MCP Skillpedia gratis: cukup satu baris, dan AI mencari di antara 15.000+ skill sebelum tiap tugas.Pasang dalam 1 menit โ†’

Contoh permintaan ke AI

โ€œPeluru cepat saya menembus dinding tipis dan peti bertumpuk saya bergetar. Bisakah Anda menyetel pengaturan fisikanya?โ€

5 skill baru setiap minggu. 1 menit baca.

Cara kerjanya

Agent memindahkan pekerjaan fisika ke timestep tetap, menginterpolasi posisi yang digambar di antara langkah, dan mengaktifkan continuous collision detection untuk objek cepat. Agent juga menyesuaikan massa, hambatan, dan layer tabrakan untuk menghentikan jitter.

Konten teknis (SKILL.md asli)

Teks asli dari pembuat, dalam bahasa Inggris, langsung dari 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
Pertanyaan umum

Mengapa memakai timestep tetap?

Skill menyebutkan bahwa langkah fisika yang konstan menjaga simulasi tetap stabil, sedangkan langkah yang berubah membuat tabrakan tidak konsisten.

Apa itu continuous collision detection?

Itu adalah metode yang mencegah objek cepat menembus dinding tipis.

Apakah ia mencakup rasa lompatan?

Bantuan rasa lompat seperti coyote time termasuk topik input dan pengendali, yang dicakup skill input.

Detail

Deskripsi asli dari pembuat

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

Popularitas

Bintang GitHub
6.6k
Peringkat
#13802
Lisensi
Apache-2.0
Diperbarui
28/10/2026

Apakah skill ini berguna?

0

Masuk untuk memberi suara.

Komentar

  • โ€ฆ

Skill lain dari repositori ini

Skill serupa