Physics Configs

    • allowSleep Whether to allow rigid bodies to enter sleep state. Default: true.
    • sleepThreshold The maximum speed threshold for entering sleep. Default: 0.1. Min: 0.
    • autoSimulation Whether to enable automatic simulation.
    • Fixed time step between each simulation. Default: 1/60. Min: 0.
    • maxSubSteps Maximum number of substeps per simulation step. Default: 1. Min: 0.
    • 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.

    Physics-collision

    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’}.

    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.

    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

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

    rigidbody-group