This document is about: QUANTUM 3
SWITCH TO

Materials

Overview

Every PhysicsBody requires a PhysicsMaterial (a quantum data-asset). The PhysicsMaterial holds properties necessary for the physics engine to resolve collisions, integration of forces and velocities.

PhysicsMaterial Data-Asset

The PhysicsMaterial holds the parameters for:

  • Restitution (sometimes referred to as "bounciness", or "bounce")
  • Restiution Combine Function
  • Friction Static
  • Friction Dynamic
  • Friction Combine Function

If no PhysicsMaterial asset is slotted, the default physics material will be assigned; the default physics material is the one linked in the SimulationConfig physics settings.

Adjusting Properties to Physics Materials
Adjusting Properties to Physics Materials.

A PhysicsMaterial asset can be assigned to a PhysicsCollider directly:

C#

var material = f.FindAsset<PhysicsMaterial>("steel");
collider.Material = material;

f.Set(entity, collider);

Important Note

A PhysicsMaterial is a data asset and lives in the Quantum Asset Database. As assets are not part of the rollback-able game state, every PhysicsMaterial is therefore to be considered immutable at runtime. Changing its properties while the game running leads to non-deterministic behaviour.

PhysicsMaterials follow the same rules as other data-assets.

C#

// this is NOT safe and cannot be rolled-back:
collider->Material.Restitution = FP._0;

// switching a reference is safe and can be rolled back:
var newMaterial = f.FindAsset<PhysicsMaterial>("ice");
collider->Material = newMaterial;

Combine Functions

The Combine Function used to resolve the restitution and friction for each collision manifold (a collision pair) is based on the combine functions' precedence order. The Physics system will chose the function with the highest precedent from the two colliders.
The precedence order is:

  1. Max
  2. Min
  3. Average
  4. Multiply

For instance: take a collision manifold with a Collider A and Collider B. Collider A's physics material has a Restitution Combine Function set to Max, while Collider B's physics material has its set to Average. Since Max has a higher priority than Average, the restitution for this collision will be solved using the Max function.

The same logic applies to the Friction Combine Function.

N.B.: The Friction Combine Function and Restitution Combine Function are resolved separately and thus carry different settings.

Back to top