Collision Geometry
Colliders define the 3D geometry that can collide with other colliders. They are also used to calculate the inertia tensor of the attached rigid body. 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. You should choose the most simple geometry type that allows you to approximate the shape of your object to sufficient detail. It usually isn’t required to model fine details in the geometry of your parts. Primitive collider types are significantly more efficient and more robust than non-primitive (custom) collider types.
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 estimated from the bounding box of the entity, if the rigid body has no collision geometry attached.
Plane
Creates an infinite yz-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 graphics mesh of the entity, along with a convex-hull around the graphics mesh of each descendant entity without their own physics.
Custom
Opens the external collider tool and uploads the graphics mesh of the entity into the tool. The tool allows you to create custom colliders that are either a set of convex-hulls, a Signed Distance Field (SDF), or a simplified triangle mesh. This is useful for modeling complex non-convex shapes that have a dynamic rigid body.
Non-Convex
Creates a triangle mesh matching the graphics mesh of the entity and its descendants, excluding any descendants with their own physics. Note that the triangle mesh collider is not solid, which means that objects with sufficiently high velocities can 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, unlike custom colliders. Avoid using non-convex colliders where possible.
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 components that don’t have their own physics components. The convex collider works similarly, but instead creates a convex-hull for each entity rather than grouping them into a single bounding collider.
To prevent an entity (and any of its descendants) from being included in the collider of an ancestor, you can add a physics component to the child entity, then set the Body type to Attached and the Collider type to None.
Offsets
There are two offsets that can be used in very specific scenarios to improve the stability of contacting rigid bodies. Note that, in the vast majority of cases, it is not recommended to change these properties from their default values.
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. The default value of -1 allows 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 rigid bodies come to rest when the colliders are touching. If the sum of the rest offsets between two colliders is positive, then the 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, thus allowing the rigid bodies to slide over each other more freely.
Custom Colliders
The custom collider tool can be used to create high-fidelity physics colliders for graphics meshes with complex topologies.
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 settings to balance quality and performance:
- Concavity Threshold: Threshold used for terminating the decomposition. The range of possible values is [0.002, 0.5].
- Merge: Whether to try merging the convex hulls together without violating the concavity threshold.
- Convex Hull Limit: Limit the maximum number of convex hulls after merging. Use the value -1 for no limitation.
- Vertex Limit: Limit the maximum number of vertices per convex hull. The range of possible values is [4, 255]. Use the value -1 for no limitation.
- Search Detail: The effort to spend searching for the best cutting planes that decompose the graphics mesh.
- Align Cutting Planes: Align cutting planes with the principal axes of the graphics mesh.
Decreasing the concavity threshold allows the tool to generate a collider with more convex-hulls that better represents the graphics mesh geometry, although it may take more time to generate the collider.
The search detail may be used to control the computational effort when searching for a more optimal solution. Increasing the search detail may result in a better decomposition without effecting the runtime performance of the main application. However, the time taken to decompose the mesh using the tool will be longer.
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 following settings allow you to edit the multi-convex collider:
- Merge: Merge the selected convex-hulls into a single convex-hull.
- Delete: Delete the selected convex-hulls.
- Undo: Undo the last merge/delete action.
- Redo: Redo the last merge/delete action that you undid.
SDF
SDF colliders are created by generating a signed distance field. You can customize the following settings to balance quality and performance:
- Resolution: The resolution controls the voxel spacing. The range of possible values is [10, 1000].
- Subgrid Size: The number of cells in a sparse subgrid block. The range of possible values is [0, 20]. Use the value 0 for a dense grid.
- Subgrid Precision: The number of bits per subgrid voxel. The possible values are 8 bits, 16 bits or 32 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. Lowering the 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. Simulating these types of shapes behave way better with SDF compared to multi-convex.
Non-convex
Non-convex colliders are created by generating a flat triangle mesh. The algorithm optimizes for edge length uniformity. You can customize the following settings to balance quality and performance:
- Target Triangle Count: The target number of triangles for the nonconvex 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. However, please note that non-convex colliders can only be attached to kinematic rigid bodies.
Toolbar
The toolbar is a set of buttons for switching between modes and performing common actions in the collider tool.
- Edit: Show the menu options for generating a custom collider.
- Navigate: Hide the menu options.
- Collider: Toggle to render the collider mesh instead of the graphics mesh.
- Wireframe: Toggle to render the graphics mesh wireframe.
- Replace Mesh: The source graphics mesh will be destroyed and replaced with the nonconvex mesh. It is sometimes useful to re-mesh before generating a SDF collider. Doing so may result in improved contact dynamics and improved runtime performance in the main application.
- Edit Collider: Simplify a multi-convex collider by merging/deleting the selected convex hulls.
- Save: Upload the custom collider back into the main application. The tool will automatically close upon performing this action.
- Settings: Open the settings for the collider tool.
- Account: Open the account page.
Infobar
The infobar displays the number of triangles, points and convex hulls, at the bottom of the viewport. The clear button removes all the generated colliders from the scene. The rotate button allows you to toggle the rotation of the graphics mesh between the identity rotation and the rotation defined in the main application. You may also toggle the projection of the camera lens between pespective and orthographic projection.
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 to toggle the projection of the camera lens between pespective and orthographic projection.