Physics
Last updated
Last updated
Physics are at the core of nearly all game mechanics in HYTOPIA. Physics control how entities interact with each other and their world.
Nearly every game mechanic starts with physics, but don't worry! HYTOPIA physics were created to be as easy as possible for you to begin working with and understand!
Let's start with an overview of core concepts within the HYTOPIA physics system.
Colliders - A collider is a shape that can collide with other shapes. A collider could be a "hitbox" of an entity, the shape that approximates terrain in the world that other entities or colliders can collide with, or a sensor that does not physically collide but detects when objects enter and exit its shape.
Collision Groups - Collision Groups allow you fully control if a collider will or will not collide with another collider.
Debugging - Sometimes you'll need to visualize physics. This means being able to see the outlines of colliders, raycasts and rigid bodies in real time.
Gravity - Simple, gravity! You can fully control gravity in your game. Remove it, change it, make it apply in a different direction, etc.
Raycasts - An invisible line (ray) in physical space that starts at a coordinate, extends in a direction for some provided length, and returns the first entity or block it intersects with, if any. Raycasts are often used for things like seeing if a bullet shot by a player hits another player, if a player is close enough to something to interact with it, and much more.
Rigid Bodies - A rigid body is an object typically made up of 1 or more colliders that interacts with the physical world. The rigid body and its child colliders ultimately define how the rigid body interacts with a world physically. An entity for example is also a rigid body and inherits all its behaviors. Rigid bodies can have linear and rotational forces applied to them, amongst many other things.
Colliders
Learn more about colliders and how they make up the foundation of a world's physical interactions.
Collision Groups
Learn more about collision groups and using them to specify what colliders can and cannot collide.
Debugging
Learn how to debug physics and enable debug rendering to visualize a world's physics elements.
Gravity
Learn how to change a world's gravity and how it affects a world's physical interactions.
Raycasts
Learn how to use simple raycasts to create exciting game mechanics and behaviors.
Rigid Bodies
Learn more about rigid bodies, applying forces, and controlling their interactions with the physical world.