Overview
Godot Engine provides a comprehensive physics system for both 2D and 3D games. The physics system handles collision detection, rigid body dynamics, kinematic bodies, and physics queries through dedicated physics servers.Physics engines
Godot supports multiple physics engine backends:Godot Physics (default)
The built-in physics engine that provides reliable physics simulation for most games. It’s well-integrated with the engine and offers good performance for typical use cases.Jolt Physics (optional)
For advanced physics requirements, Godot supports Jolt Physics, a high-performance physics engine that excels at handling large numbers of physics objects.Jolt Physics can be enabled through project settings under Physics > 3D > Physics Engine.
Physics servers
Godot uses a server-based architecture for physics:PhysicsServer2D
Handles all 2D physics operations. The server provides low-level access to create and manipulate physics objects directly without using scene nodes.PhysicsServer3D
Handles all 3D physics operations. It provides the same low-level control for 3D physics objects.Physics spaces
A physics space is a self-contained world for physics simulation. Each space maintains its own set of bodies, areas, and joints.Space properties
Collision detection
Collision detection
Spaces handle broad-phase and narrow-phase collision detection between all objects within the space.
Gravity
Gravity
Each space can have its own gravity settings, independent of other spaces.
Simulation parameters
Simulation parameters
Customize solver iterations, contact recycle radius, and other simulation parameters per space.
World spaces
When using the scene tree, physics spaces are automatically created:Body modes
Physics bodies can operate in different modes:Static bodies
Static bodies don’t move and are optimized for stationary objects like walls and floors.Kinematic bodies
Kinematic bodies are controlled by code rather than physics forces. They’re ideal for player characters.Rigid bodies
Rigid bodies are fully simulated by the physics engine and respond to forces, gravity, and collisions.Animatable bodies
Animatable bodies are static bodies that can be moved through animations without affecting other physics objects.Areas
Areas are regions in space used for detection rather than collision. They can detect bodies entering and exiting, and override physics properties like gravity.Collision layers and masks
Godot uses a layer and mask system to control which objects can collide with each other.Physics callbacks
Customize physics behavior with callbacks:Performance considerations
Use static bodies
Static bodies are highly optimized. Use them for non-moving geometry.
Simplify collision shapes
Use primitive shapes (box, sphere, capsule) when possible instead of complex meshes.
Manage active bodies
Bodies automatically sleep when stationary. Avoid waking sleeping bodies unnecessarily.
Optimize layers
Use collision layers effectively to reduce unnecessary collision checks.
Next steps
Collision shapes
Learn about different collision shape types
Raycasting
Perform physics queries and raycasts
Joints
Connect bodies with physics joints