Inside the dot8 Physics Engine
Building a physics engine isn’t just about moving objects—it’s about creating a consistent and believable world. Rigidbodies define how objects react to forces, gravity, and collisions, while colliders determine the shape and boundaries for those interactions. Together, they form the backbone of any physics simulation, enabling everything from subtle character movement to complex dynamic environments. Understanding how these components work together is key for developers who want precision, performance, and realism in their games. Mastering these fundamentals isn’t just a technical skill—it’s what transforms code into immersive experiences.
Rigidbody: Motion in Action
A Rigidbody defines how an entity moves in the game world:
- Velocity - 2D vector for movement per frame.
- Acceleration - Enables force-based motion.
- Gravity - Global or per object (set to 0 for flying entities).
- Damping/Friction - Gradually reduces speed for smooth stops.
- Integration Step - Updates position each frame with a fixed timestep.
| |
Key Insight: A Rigidbody doesn’t detect collisions — it only updates position based on forces.
Collider: The Silent Watcher
-A Collider focuses on where interactions happen. In retro engines, this is usually an AABB (Axis-Aligned Bounding Box):
- Offset - Position offset from the entity’s origin to align with the sprite.
- Size - Defines collision area.
- Trigger Flag - Marks collider as “non-physical” (no bounce/push, only events).
- Layer/Mask - Filters what this collider interacts with (e.g., Player layer vs. Enemy layer).
- Response - None (for triggers) or simple reaction (bounce, stop).
| |
Key Insight: A Collider never moves objects — it only reports contacts.
See Colliders in action
Why Keep Them Separate?
Splitting Rigidbody and Collider gives dot8:
- Modularity - An object can have physics without collision, or vice versa.
- Performance - Collider checks can be optimized separately.
- Flexibility - Triggers and sensors can exist without affecting motion.
Rigidbodies and Colliders work together to bring physics to life. One controls movement, the other defines interaction. Simple, but powerful. How will you use them in your game?
