Table of Contents

Struct PhysicsMaterial

Namespace
Box3D
Assembly
Box3D.NET.dll

The surface properties of a shape: how it rubs, how it bounces, and how it drags things along.

public readonly record struct PhysicsMaterial : IEquatable<PhysicsMaterial>

Implements

Inherited Members

Examples

var ice = PhysicsMaterial.Default with { Friction = 0.02f };
var rubber = PhysicsMaterial.Default with { Restitution = 0.9f };

// A conveyor belt: the surface itself drags contacts along its local x axis.
var belt = PhysicsMaterial.Default with { SurfaceVelocity = new Vector3(2.0f, 0.0f, 0.0f) };

Remarks

When two shapes touch, their materials are combined. By default friction combines as the geometric mean and restitution as the maximum, so one bouncy surface is enough to make a collision bounce. Both rules can be replaced per world.

Meshes and height fields can carry a different material per triangle; convex shapes have exactly one.

Properties

Default

Gets the default material: moderate friction and no bounce.

Friction

Gets the Coulomb friction coefficient, normally between zero and one.

Restitution

Gets the bounciness, from zero for a dead stop to one for a perfectly elastic bounce.

RollingResistance

Gets the rolling resistance, normally between zero and one.

SurfaceVelocity

Gets the surface velocity, in shape-local space, used for conveyor belts.

UserMaterialId

Gets an application-defined identifier reported with query results and passed to the friction and restitution combining callbacks.