Skip to content

Collisions

Advanced Collisions


Default settings should handle most of common use-cases for collision detection. However, if collisions do not seem to be detected appropriately, advanced setting can help you tune your simulation to your needs.

Collision advanced parameters

LMD Max

When two rigidbodys are close and a collision might happen, we use a dedicated solver that will compute minimal distance for every geometrical section of our mesh. For performance reason, we need to search a reasonable region around the object to search for collision. This search region can be defined using the LMD Max parameter, also called Local Minimum Distance. It is the maximal length (in meters) of collision detection around an object during one timestep.

Timestep is in seconds and can be tuned in XdeScene component.

Fast traveling objects

If an object travels more than LMD Max during one timestep, the physics engine might miss a collision with another rigidbody. You can decrease the Timestep or/and increase the LMD Max.

Composite offset

CAD data need to be tessellated into a mesh to be displayed in 3D applications or to compute simulation. This process induces a chord error (or sag) between the nominal CAD data (exact geometry created from mathematical function) and the tessellated mesh (discretized geometry).


The purpose of the composite offset property (measured in meters) from a XdeRigidBody component is to expand the mesh collider in order to compensate this chord error.

Indeed in convex geometries the mesh volume is smaller than CAD one and it can induce issue on simulating precise collision if the chord error is not taken into account.

With the composite offset we create a dilated mesh collider.

Dilation

In the Xde Mesh Collider component of a physicalize object you will find a dilation property :

The dilation of the mesh collider is measured in meters. This parameter has the same purpose of Composite Offset, except this one will be applied to a specific XdeMeshCollider instead of a XdeRigidbody.

Default value is 0.

Sphere/Capsule collider

It is possible to create a collider for an exact sphere by setting a "dilatation" on a mesh that only has one point. Similarly, a capsule collider can be created by dilating a line.

Time step control mode

To keep collision detection robust even with fast-moving objects, the Time Step Control Mode parameter, in the advanced engine parameters of the XdeScene component, lets you choose how the engine reacts when an object would travel farther than LMD max during a timestep:

  • Substepping (default): the engine automatically splits the timestep into smaller sub-steps so the motion never exceeds LMD max within a sub-step, then catches up to the next full timestep. This keeps collision detection robust for fast-moving objects without capping their velocity, but the simulation can appear to slow down when objects get close to one another, since more sub-steps are then needed to integrate the same physical duration.
  • Limited: clamps an object's velocity so it never travels farther than LMD max during a timestep. This is the former Velocity limiter option: it guarantees no collision is missed, but it can noticeably slow down fast manipulation or fast-moving parts.
  • As Desired: always integrates using the exact configured Time Step, without slowing down objects or splitting steps. The timestep stays constant regardless of how fast objects move, but a fast-moving thin object can tunnel through an obstacle without the collision being detected.

Choosing a mode

Substepping is recommended for most scenes, as it gives robust collision detection with a limited impact on interactive manipulation. Use Limited when you need a guaranteed, easily predictable maximum velocity, for example with a Spacemouse-driven manipulator. Use As Desired only if you need a strictly constant timestep and can tolerate missed collisions on fast-moving objects.

Configuring materials friction

XDE provides various friction models to help you add more physical realism to your simulation.
To configure a friction model between two objects, you need to assign a contact material to each object and configure the friction model between the two materials.

  • Create a contact material: To create a new material, use the XdeContactRuleSet component located in the [PhysicsManager] inspector tab and click on Create New Material.

  • Configure the friction model between 2 materials: Click at the intersection of the 2 materials in the friction matrix.

Then select the tangential law (No friction, Coulomb, Coulomb-Contensou) and Normal law (Signorini or Compliant).

The Signorini law is in fact not a friction law, but a contact law. This law ensures that when two objects are in contact, the minimal distance between the two object is null, and there is a strictly positive contact force. On the opposite, when there is no contact, the contact force must be null and the minimal distance between the two object is strictly positive. With this law, there is no tangent force, hence no friction.

The Coulomb law states that when a contact occurs, the tangential force norm must be included in a disk whose radius is mu n, where n is the contact force normal value, and mu the friction coefficient. When the tangential forces lies inside the disk, there is no slipping, whereas when the tangential force is on the circle edge, the contact is slipping, and this slipping occurs in the opposite direction of the tangential force. This is the most frequently used law to model friction.

The Coulomb Contensou law is an extension of the Coulomb law to rotational friction. Indeed, with the coulomb law, no friction occurs when an object is rotated around a contact points. This means that if you grab an object with two material points using Coulomb friction, you won’t be able to control the object orientation around the axis formed by the two contact points. The object will freely rotate around this axis.

  • Assign a contact material: To assign a contact material, on your XdeRigidBody's object select the material in the dropdown list Contact Material.

    Assign a material to the player's hands.

    In the hierarchy, open [Player_1] > Devices > LeftHand, select all of the children and assign in Contact Material "Player", a material you will have created before. Same for RightHand.