Rigid Body
A Rigid Body represents a component that can be simulated within the physics engine. These components maintain a constant shape, hence the term 'rigid'. Changes in a Rigid Body's position or orientation over time are determined by the physics engine, based on forces applied to it.
Adding a Rigid Body
Adding a Rigid Body to Mattercraft is simple and intuitive. Simply add a Physics → Rigid Body
Behavior to a component.
The Rigid Body Behavior sets up and exposes everything you need to get started with physics, including creating a default Collider (depicted as a green bounding box) to wrap around your component.
Clicking the Play
button in the top-left of the viewport will simulate the physics in your current active zcomponent (Scene).
You can update and customize your Rigid Body Behavior properties in the Behaviors Panel.
Rigid body properties
Components that have the Rigid Body
Behavior attached will have the following additional properties:
Property | Description |
---|---|
Motion Type |
Describes how the Rigid Body is able to move. These options are:Static : Not affected by external forces (collisions, gravity, etc.) and is optimized to never move. Great for platforms, buildings, etc.Dynamic : Natural movement and affected by external forces. Used for things that need to bounce, have friction, etc.Kinematic : Not affected by external forces but can be animated, for example, on a timeline. Perfect for things like moving platforms. |
Report Collisions |
If true , an onCollision event is emitted. |
Bounciness |
This describes how bouncy the object will be.0 : No energy is retained and it will not bounce.1 : All energy is retained and will bounce. |
Friction |
Determines how much an object will slow down. Important for simulating realistic physics, such as an object sliding across a surface. |
Mass |
Sets the Rigid Body's overall mass, which affects how easy it is to move. |
Inertia |
Determines how easy the object is to rotate. |
Inertia Orientation |
Describes the axes that a Rigid Body spins around. |
Center of Mass |
Sets the Rigid Body’s mass distribution. |
Gravity Factor |
Sets the force of gravity on a Rigid Body. |
Linear Damping |
Sets how fast the linear velocity decreases on the Rigid Body over time. |
Angular Damping |
Sets how much the Rigid Body resists rotating over time. |
Density |
Sets the Rigid Body’s overall density. |
See Mattercraft's full API documentation here.
Customization of Rigid Bodies
If you’d like to customize the collider or physics settings further, check out the articles below:
Next article: Colliders