Collision Geometry
Colliders define the 3D geometry that can collide with other colliders. They are also used to calculate the inertia tensor for the rigid body to which they are attached. All colliders must be attached to a rigid body.
Types
There are six types of collision geometry that can be attached to a rigid body.
None
No collider will be created for the entity. This can be used to improve performance for machines when collisions between parts of the machine are not important. However, note that the inertia tensor for the rigid body will be assumed as that of a box with sides of 1m if the rigid body has no collision geometry attached.
Plane
Creates an infinite plane with normal aligned with the local x-axis of the entity. Plane colliders can only be attached to kinematic rigid bodies, since the inertia tensor for infinite geometry is undefined.
Sphere
Creates a perfect bounding sphere encompassing the bounds of the entity and its descendants, excluding any descendants with their own physics.
Box
Creates a bounding box encompassing the bounds of the entity and its descendants, excluding any descendants with their own physics.
Convex
Creates a convex-hull around the graphical mesh of the entity, along with a convex-hull around the graphical mesh of each descendant without their own physics.
Custom
Loads a custom collider, consisting of a set of convex-hulls, created using the custom collider tool.
Non-Convex
Creates a triangle mesh matching the graphical mesh of the entity and its descendants, excluding any descendants with their own physics. Note that the triangle mesh collider is not solid, allowing objects with sufficiently high velocities to tunnel through into the interior of the mesh. Non-convex colliders incur a high computational cost and can only be attached to kinematic rigid bodies.
Hierarchy
The sphere, box and non-convex colliders define collision geometry for the entity along with (potentially) any descendants in the hierarchy. This works by looking down the hierarchy and including any entities with graphics that don’t have their own physics components. The convex collider works similarly, but creates a convex-hull for each entity rather than grouping them into a single bounding collider.
If you want to prevent an entity (and any of its descendants) from being included in the collider of an ancestor, you can add a physics component and set the Body type to “Attached” and the Collider type to “None”.
Offsets
There are two offsets that can be used to improve the stability of contacting rigid bodies.
Contact Offset
The contact offset defines a radius around the collision geometry. Contact points are generated when the distance between the colliders is less than the sum of their contact offsets. This can improve the stability of stacks of rigid bodies. However, if set too large, many more contact points could be generated, resulting in an increased computational cost. Using the default value of -1 causes ProtoTwin to automatically calculate a suitable contact offset from the dimensions of the collision geometry.
Rest Offset
The rest offset defines the distance between the collision geometry at which two rigid bodies come to rest. The default value is zero, meaning that the rigid bodies will come to rest when the colliders are touching. If the sum of the rest offsets between two colliders is positive then the rigid bodies will come to rest when the collision geometry is separated by the sum of the rest offsets. Using a small positive rest offset can prevent edge catching at the seams between colliders, allowing the rigid bodies to slide over each other more freely.
Custom Colliders
The custom physics collider tool can be used to create high-fidelity colliders for non-convex meshes by decomposing the graphical mesh into a set of convex hulls.
Settings
You can customize the settings to balance quality and performance:
- Concavity Threshold - Threshold used for terminating the decomposition
[0.002, 0.5]
. - Merge - Merge convex hulls after decomposing the input mesh.
- Convex Hull Limit - The maximum number of convex hulls after merging. Use
-1
for no limitation. - Vertex Limit - The maximum number of vertices per convex hull
[4, 255]
. Use-1
for no limitation. - Search Detail - The effort to spend searching for the best cutting planes.
- Align Cutting Planes - Align cutting planes with the principal axes of the input mesh.
By decreasing the concavity threshold, the tool will generate a more precise decomposition of the input mesh with more convex hulls. However, the generation time increases exponentially. In some cases, you may need to use a value as low as 0.002
. For most meshes, a value between 0.02
and 0.05
provides a sufficiently accurate result.
The search detail is used to control the computational effort to use when searching for a more optimal solution. Increasing the search detail may provide a better decomposition without negatively affecting the runtime performance. However, the time required to decompose the mesh using the tool will increase.
Control
Displays the number of triangles, points and convex hulls at the bottom right of the viewport and some included buttons:
- Toggle - Toggle between displaying the input graphics mesh and the generated custom physics mesh.
- Wireframe - Toggle between rendering a wireframe of the input graphics mesh or custom physics mesh.
- Up Axis - Change the up axis of the camera.
- Export - Export the custom physics mesh to a
.OBJ/.GLTF/.PTC
file. The.PTC
file is a ProtoTwin custom collider file that can be imported into the application. - Clear - Clear the scene.
Input File Types
The supported file types for importing meshes are:
- GLTF
- GLB
- OBJ
- PTC (ProtoTwin Custom Collider)