Physics Configs

Physical configuration is used to configure various commonly used properties.

Property description


  • gravity Gravity direction vector, the sign means the positive or negative direction on the axis. Default: { x: 0, y: -10, z: 0 }.
  • allowSleep Whether to allow rigid bodies to enter sleep state. Default: true.
  • sleepThreshold The maximum speed threshold for entering sleep. Default: 0.1Min: 0.
  • autoSimulation Whether to enable automatic simulation.
  • fixedTimeStep Fixed time step between each simulation. Default: 1/60, Min: 0.
  • maxSubSteps Maximum number of substeps per simulation step. Default: 1, Min: 0.
  • friction Coefficient of friction. Default: 0.5.
  • rollingFriction Rolling friction coefficient. Default: 0.1.
  • spinningFriction Spin friction coefficient. Default: 0.1.
  • restitution Coefficient of elasticity. Default: 0.1.
  • collisionMatrix The collision matrix, used only for initialization.

Collision Matrix

The collision matrix is used to initialize groups and masks of physical elements.


Grouping concept

In the editor, the grouping format of the collision matrix is {index, name}, index is the number of bits from 0 to 31, and name is the name of the group. The new project will have a default grouping: {index: 0, name: 'DEFAULT'}.

By clicking the + button you can add a new group.

Note: both index and name cannot be empty and cannot be repeated with existing items; after adding, the group cannot be deleted, only the name of the group can be modified.

How to configure

Take a new water group as an example:


This table lists all the groups, and you can check it to determine which two groups will do the collision detection.

As shown in the figure above, whether DEFAULT and water will perform collision detection will be determined by whether the corresponding check box is checked.

According to the above rules, the collision pairs generated in this table are:

  • DEFAULT - water

And the grouping pairs that do not perform collision detection include:

  • water - water

Configure groups of physical components

In addition, the Group property on the RigidBody component needs to be configured into the corresponding physical element:


results matching ""

    No results matching ""