Game physics simulates real-world behavior in virtual environments. From gravity and collision to friction and velocity, physics brings realism and interactivity to games—whether it’s a bouncing ball or a ragdoll character.
Key concepts:
- Rigid Bodies: Represent physical objects that move and respond to forces.
- Colliders: Define the shape for collision detection (box, sphere, polygon).
- Forces and Impulses: Used to move or push objects (
AddForce()
in Unity). - Gravity: Pulls objects down at a defined rate.
- Friction & Drag: Slow down movement based on surfaces and air resistance.
- Kinematic Bodies: Manually controlled objects not affected by physics forces.
2D vs. 3D Physics:
- Use
Rigidbody2D
,BoxCollider2D
in 2D games. - Use
Rigidbody
,MeshCollider
, orCapsuleCollider
for 3D environments.
Common uses:
- Platformer jumps and falls.
- Projectile motion and explosions.
- Vehicle handling and crash simulation.
- Puzzle and ragdoll mechanics.
Modern game engines like Unity, Unreal, and Godot provide built-in physics engines (e.g., PhysX, Bullet). While you don’t need to be a physicist, understanding basic principles helps you create believable and fun interactions.