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 collider tool can be used to create high-fidelity colliders for meshes with complex topology.
Collider Types
The custom collider tool supports 3 different types of custom colliders:
- Multi-convex
- SDF
- Non-convex
Multi-convex
Multi-convex colliders are created by generating a convex decomposition. You can customize the following options to balance quality and performance:
- Concavity Threshold - Threshold used for terminating the decomposition
[0.002, 0.5]
. - Merge - Try to merge convex hulls without violating the concavity threshold.
- Convex Hull Limit - Limit the maximum number of convex hulls after merging. Use
-1
for no limitation. - Vertex Limit - 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 that decompose the mesh.
- Align Cutting Planes - Align cutting planes with principal axes of the mesh.
Once the multi-convex collider has been generated, it is possible to manually simplify the collider by clicking the edit collider button in the toolbar. The buttons displayed upon doing this are resposible for the following actions:
- Merge - Merges the selected convex hulls.
- Delete - Deletes the selected convex hulls.
- Undo - Undo the merge/delete action.
- Redo - Redo the merge/delete action.
If you decrease the concavity threshold, the tool will generate a more accurate collider with a greater number of convex hulls, but will take a longer time to do so. 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
is probably good enough.
The search detail can be used to control the computational effort when searching for a more optimal solution. Increasing the search detail might result in a better decomposition without hurting runtime performance in the main application. However, the time taken to decompose the mesh using the tool will be longer.
SDF
SDF colliders are created by generating a signed distance field. You can customize the following options to balance quality and performance:
- Resolution - The resolution controls the voxel spacing
[10, 1000]
. - Subgrid Size - The number of cells in a sparse subgrid block. Use
0
for a dense grid[0, 20]
. - Subgrid Precision - The number of bits per subgrid voxel. You can use either
8
bits,16
bits or32
bits. - Thickness - The thickness controls the size of the band that gets created around the mesh surface. Every subgrid block that overlaps the band is kept, ensuring high resolution around the mesh surface. A lower value results in less subgrid blocks being created and reduces memory consumption.
SDF colliders consist of a point cloud and a triangle mesh. They are more computationally expensive than multi-convex colliders, but are much more suitable if you require accurate collision geometry. For example, detecting precise collisions between the threads of a nut and bolt are not possible with multi-convex colliders, or certain types of cam/screw mechanisms, which behave much better with SDF compared to multi-convex.
Non-convex
Non-convex colliders are created by generating a triangle mesh. The algorithm optimizes for edge length uniformity. You can customize the following options to balance quality and performance:
- Target Triangle Count - The target number of triangles to generate for the nonconvex triangle mesh.
Non-convex colliders can be set directly in the main application, however they will use the graphics triangle mesh for the collision geometry. The tool can be used to improve contact dynamics by generating more uniformly lengthed triangles and improve runtime performance by generating a triangle mesh with less triangles. Non-convex colliders can only be attached to kinematic rigid bodies.
Toolbar
The toolbar buttons are resposible for the following actions:
- Edit - Display the menu options for generating a custom collider.
- Navigate - Hide the menu options.
- Collider - Toggle to render the collider mesh.
- Wireframe - Toggle to render the mesh wireframe.
- Replace Mesh - The source mesh will be destroyed and replaced with the nonconvex mesh. It is sometimes useful to re-mesh before generating an SDF collider. Doing so may result in improved contact dynamics and runtime performance.
- Edit Collider - Simplify a multi-convex collider by merging/deleting the selected convex hulls.
- Axis - Toggle the up axis of the camera.
- Export - Export the custom collider to a
.PTC
file. The.PTC
file is a ProtoTwin custom collider file that can be imported into the main application. - Clear - Clear the scene, removing all meshes and colliders.
- Settings - Open the settings for the collider tool.
- Account - Open the account page.
Controlbar
The controlbar displays the number of triangles, vertices and colliders at the bottom right of the viewport. You can also toggle the lens projection of the camera between pespective and orthographic.
View Cube
The view cube is displayed at the bottom right of the viewport and shows a graphical representation of the orientation of the camera.
- Left clicking on an axis of the view cube aligns the camera to look against the direction of the selected axis.
- Right clicking on the view cube is a shortcut for toggling the lens projection of the camera between pespective and orthographic.
The orthographic view can be useful for determining whether the generated collider is good enough.
File Types
The supported file types for imported meshes are:
- GLTF
- GLB
- OBJ
- PTC