Physics Material
By default, the Rigid Body Behavior properties provide basic options to modify your physics properties, such as Bounciness
and Friction
. You may occasionally however require fine-tuned control over the physics properties of individual colliders.
For more advanced options, a PhysicsMaterial
component can be childed to any collider.
Adding a Physics Material
Adding a Physics Material to a Collider in Mattercraft is straightforward. To add a Physics Material, right click on your Collider in the Hierarchy and add a New → Physics → Physics Material
.
Physics Material properties
Colliders that have the Physics Material
component childed will have the following specific properties:
Property | Description |
---|---|
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. |
Bounciness Combine |
Describes how two different Bounciness values should be combined. |
Friction |
Determines how much an object will slow down. Important for simulating realistic physics, such as an object sliding across a surface. |
Static Friction |
Determines the Friction an object must overcome before sliding relative to another object. |
Friction Combine |
Determines how values from the Physics Material are combined when two objects are in contact. |
Example: Mixed Collider properties
Consider the following example:
In this example, the Rigid Body (Box
in the example Hierarchy above) has Bounciness
set to 0.8
and Friction
set to 0.5
. These properties will apply to the first Shape
Collider (a child of the Box
component) because it doesn't have a Physics Material childed to it.
However, the second Shape Collider (Shape Collider Sphere
in the example Hierarchy above) does have a Physics Material childed to it. The Physics Material on this component specifies a Bounciness
of 0.2
and a Friction
of 0.9
. These values will override the Rigid Body's Bounciness
and Friction
property values for that specific collider.
This allows for a mix of Collider properties within the same Rigid Body, with some colliders inheriting the Rigid Body's properties and others using their own Physics Material properties.
Example: Partial overrides
Consider the following demonstration:
In this example, the PhysicsMaterial
childed to the Shape Collider only specifies a Friction
value of 0.2
. It does not specify a Bounciness
value.
In this case, the Friction
value and the default Bounciness
value from the Physics Material will be used for the Collider, overriding the Rigid Body's properties.
This demonstrates that when a Physics Material is attached to a Collider, it will fully override any properties it specifies, even if it doesn't specify all properties.
Next article: Physics Settings