Optional
options: Partial<RigidBodyOptions>Acceleration expressed in pixels per second squared. Only for Dynamic bodies
Gravity expressed in pixels per second squared. Only for Dynamic bodies
The type of the rigid body to create:
Velocity applied to the x-axis and y-axis expressed in pixels per second. Only for Dynamic bodies
The RigidBody component enables physics simulation for an entity, allowing it to interact with other physics-enabled objects in the game world.
It defines how the entity behaves under forces like gravity, collisions, and applied velocities. The component supports three types of bodies:
Dynamic: Fully physics-simulated bodies that respond to forces, collisions, gravity, and can be moved by other rigid bodies. Best for objects that need realistic physical behavior like players, projectiles, or items.
Kinematic: Bodies that can move with applied velocities but are not affected by gravity or collisions from other bodies. Ideal for moving platforms, enemies with predefined paths, or objects that need controlled movement without full physics simulation. More performance efficient than Dynamic bodies.
Static: Immobile bodies that act as solid, unmovable obstacles. They don't respond to any forces or collisions. Perfect for level geometry, walls, or any unchanging collision objects. The most performance efficient option as they require minimal physics calculations.
Example
Example
Example