Collision Geometries
When creating parts, you can add primitive geometric shapes, such as boxes, spheres, capsules, planes, and cylinders.
You can also create polygon-based geometries, such as triangle meshes and composite type geometries. These shapes define the behavior of a part upon collision; however, they do not have any bearing on its dynamic behavior. If a part does not have collision, buoyancy, or drag geometries, it will not collide with other parts. The position and volume of geometries are optionally used to determine the inertia tensor properties. The figure below indicates where geometries are located in the Vortex® hierarchy.
A geometry can be used in any of these contexts:
- Model collisions between rigid bodies
- Model fluid dynamics (buoyancy, drag, lift)
Buoyancy and drag are used to allow interaction of the part with fluid, for example when building subsea mechanisms such as a remotely operated vehicle (ROV). For more information please refer to 3574548502.
After you add a geometry to a Part, you should modify properties such as position, orientation, and its dimensions as well as the associated Part's center of mass (COM) and the inertia tensor.
For a list of supported geometries, please refer to 3574548502.
The Relationship Between Geometries, Parts, and Materials
When a Part (or rigid body) collides with another, contacts are produced which represent the physical interactions between the colliding bodies. The resultant collision forces can be controlled through material properties associated with these contacts, such as compliance, friction, adhesion, and restitution. To this end, every geometry can have a single material assigned to it, such as steel or rubber. Upon collision between two geometries, the resultant contact's properties are chosen based on the colliding pair of materials, such as "steel with rubber", or "rubber with asphalt".
For each such material pairing, referred to as contact material, the properties that define the collision forces can be found in a material table. The material table, as such, contains physical parameters that describe the material properties of colliding rigid bodies.
Let's look at a concrete example. When a tennis ball hits or contacts with the ground, there are two objects: the tennis ball and the terrain (tennis court). The tennis ball has a collision geometry with a sphere shape and is made up of an associated Rubber material. The ground or terrain is made up of Asphalt material and has a collision geometry of a plane. Therefore, the contact material is Asphalt+Rubber:
Assigning a Material to a Collision Geometry
You can assign a specific material to each collision geometry defined on a part.
For example, in order to achieve the correct collision response when a wheel collides with terrain, you could assign the Wheel material the wheel's collision geometry and assign Mud, Ice, or Ground to the terrain's geometry.
To assign a specific material to a collision geometry, follow this procedure:
- Open the
.vxassembly
file containing the Part and Collision Geometry you want to modify. From the Explorer, select the geometry you want to modify.
Its properties appear in the Property panel on the right side of your workspace.
Locate the Material text box at the bottom of the list of properties.
Carefully type the name of the Material you want to assign to this geometry.
Materials are case-sensitive, so it is very important that you type the name of the material exactly as it appears in the Materials Table.At runtime, if Vortex® cannot find the material matching the name you typed, then it will use the default material instead.You can now validate the materials in your scene, mechanism, or assembly.
Editing Position, Orientation, and Shape of a Geometry
You can edit position orientation and shape of every Geometry.
Open the
.vxassembly
file containing the Part and Collision Geometry you want to modify.In the Explorer panel, select the geometry that you want to modify.
Different properties are displayed depending on the type of geometry you select. For example, Drag Coefficient properties will be displayed for the Drag type geometry.Set the Position and Orientation properties of the geometry using either of these methods:
- By using the Transform tools in the 3D View
- By editing the values directly in the Properties panel
Set the dimensions of the geometry: for example, the radius of a sphere, the length of a capsule, or the dimensions of a box.
By default, all geometries will be used when calculating collision. However, if you want to remove a specific geometry from the calculation, uncheck its Enabled option.
Changing the Geometry Interaction Type
When you click on the Part icon in the Explorer, the Properties panel displays a table of geometries defined on the part, with checkboxes indicating whether they are Collision, Buoyancy, Drag, or Lift geometries or a combination of geometries. Note that the different types of geometries have a different color in the 3D View.
You can use this table to redefine the collision type of geometry. The table also provides quick links to the shape properties.
If you don't already have a part with geometry, follow the procedure in Building Assemblies from a 3D Model or Creating Parts and Geometries Manually.
Select the part you want to edit in the Explorer panel.
The Geometries section displays the name and type of all geometries in the Properties panel.Click the arrow to the left of the geometry to open the specific properties for that shape.
To use a different geometry, select the check box you want and de-select the one you don't want.
If you switch geometry types, new type-specific properties will appear on the geometry shape's property list. For example, if you change the geometry type on a Cylinder from Collision to Buoyancy, Drag, or Lift, click on its arrow to display the Cylinder's Properties panel Fluid Interaction section.
Fluid Interaction with Geometries
Geometries support fluid interaction and can be used to model Buoyancy, Drag, and Lift forces applied to Parts. The following sections explain how to enable these features.
Enabling Buoyancy
If you don't already have a part that contains the buoyancy geometry, follow the procedure in Creating Parts and Geometries Manually.
You can also convert an existing type from Collision or Drag to Buoyancy by following the procedure under Changing the Geometry Type (Collision, Buoyancy, Drag, Lift).
- In the Explorer panel, select the geometry shape (for example, Cylinder).
- Under the Fluid interaction section, set the following:
- Center of Buoyancy
- Displaced volume
Center of Buoyancy
The center of buoyancy refers to the point through which the buoyancy force acts. Vortex® calculates the center of buoyancy from the centroid of the displaced fluid.
The center of buoyancy is given in the local frame of the geometry. By default, its three coordinates are (0,0,0), which coincides with the center of the geometry.
Displaced Volume
The displaced volume is the volume of fluid displaced by the collision geometry when it is wholly immersed.
For more information about setting buoyancy in the SDK, see Buoyancy Force.
Enabling the Drag Force
If you don't already have a part that contains the Drag geometry, follow the procedure in Creating Parts and Geometries Manually.
- In the Explorer panel, select the geometry shape (for example, Cylinder).
- Under the Fluid interaction section, set the drag coefficients. (See Drag Force for more information.)
The drag coefficients are used to model all of the complex dependencies of shape, inclination, and some flow conditions on drag. This equation is a rearrangement of the drag equation where we solve for the drag coefficients in terms of the other variables. Setting proper drag coefficients will result in more predictable simulations.
Enabling the Lift Force
If you don't already have a part that contains the Lift geometry, follow the procedure in Creating Parts and Geometries Manually.
- In the Explorer panel, select the geometry shape (for example, Cylinder).
- Under the Fluid interaction section, set the lift coefficients. (See Lift Force for more information.)
The lift coefficients are used to model all of the complex dependencies of shape, inclination, and some flow conditions on the lift. This equation is a rearrangement of the lift equation where we solve for the lift coefficients in terms of the other variables. Setting proper lift coefficients will result in more predictable simulations.
Creating Composite Collision Geometries
Composite collision geometries allow you to place basic geometries into a composite geometry. It is generally the best way to model complex collision geometries for dynamic objects.
This composite reduces the number of contact points and optimizes collision detection treating the collection of collision geometries in the composite as one entity. The result is a more efficient simulation and improved dynamics when using composite geometries.
To create a composite geometry, complete the following:
- In Vortex® Studio Editor, create a new assembly then add a new part to the assembly.
- In the Toolbox, select the Collision Geometries category then double-click the Composite Geometry icon to add one to the Explorer panel.
- In the Explorer panel, drag geometries onto the newly created Composite.
The geometries inside the Composite folder will now behave as a composite geometry and can be manipulated like a single part geometry. You can remove geometries from the composite folder by dragging them out of the folder. You can also right-click part geometries in the Explorer panel and click Add to New Composite.
Creating Geometries using Convex Mesh Decomposition
When creating a collision geometry for a part, one option is to use convex mesh decomposition from a reference 3D model. This will automatically create an arrangement of convex meshes that closely model the shape of the 3D model.
|
An example of a claw before and after V-HACD convex mesh decomposition |
---|
To specify convex mesh decomposition:
- In a mechanism file's Explorer panel, right-click on a part that has been added to an assembly.
- Select Create Best-Fit Geometry > Convex Mesh Decomposition...
- In the resulting dialog box, configure the following parameters:
- Graphics Node: The graphics node associated with the selected part appears in this field.
- Ignored Graphics Nodes (RegEx): In this field, you can add graphics nodes that you want to exclude from the mesh (for example, sub-nodes that you want to ignore). This field must be a sequence written using RegEx syntax.
- Decomposition method: In this field select either
- Volumetric Hierarchical Approximate Convex Decomposition (V-HACD): This method is based on a volumetric approximation of the input mesh. It will create convex meshes ideal for stable collisions, but will not approximate sharp geometric features well.
- Hierarchical Approximate Convex Decomposition (HACD): This method uses the vertices of the input mesh directly to create the convex meshes, rather than using a volumetric approximation as done in V-HACD. As such, HACD is recommended to capture sharp geometric features for high-precision collision detection. However. this method could lead to holes in the generated decomposition.
- Level of Detail: Select the desired level of detail. The presets automatically assign values to the Advanced Parameters below. In order to enter your own values, select Custom.
- Advanced Parameters (V-HACD):
- Resolution: Maximum number of voxels generated during the voxelization stage.
- Depth: Maximum number of clipping stages. During each clip (or split) stage, all the model parts with a concavity higher than the user-defined threshold are clipped according to the "best" clipping plane.
- Concavity: Maximum concavity.
- planeDownsampling: Controls the granularity of the search for the "best" clipping plane.
- convexhullDownsampling: Controls the precision of the convex hull generation process during the clipping plane selection stage.
- Alpha: Controls the bias toward clipping along symmetry planes.
- Beta: Controls the bias toward clipping along revolution axes.
- Gamma: Maximum allowed concavity during the merge stage.
- PCA: Selecting this field normalizes the mesh before applying the convex decomposition.
- voxelMode: Selecting this field enables voxel-based approximate convex decomposition. If not selected, tetrahedron-based approximate convex decomposition is used.
- maxNumVerticesPerCH: Controls the maximum number of triangles per convex hull.
- minVolumePerCH: Controls the adaptive sampling of the generated convex hulls.
- Advanced Parameters (HACD):
- targetTrianglesDecimateMeshCount: Target number of triangles in the decimated mesh.
- verticesPerCHCount: Maximum number of vertices in the generated convex hulls.
- scaleFactor: Normalization factor used to ensure that the other parameters (e.g., concavity) are expressed with respect to a fixed size.
- smallClusterThreshold: Threshold on the cluster's area (expressed as a percentage of the entire mesh area) under which the cluster is considered small and it is forced to be merged with other clusters at the price of a high concavity.
- addFacesPoints: If selected, an additional ray located at the center of each triangle pointing toward its normal is considered when computing the concavity of a non-flat cluster. This parameter can be used to handle coarse meshes (i.e., meshes with a low number of vertices).
- addExtraDistPoints: If selected, additional rays are considered to handle bowl-like shapes.
- clusterCount: Minimum number of convex hulls to be generated.
- Concavity: Maximum allowed concavity.
- connectDist: If the distance between two triangles, each belonging to a different connected component, is lower than the connectDist threshold, an additional edge connecting them is added to the dual graph. This parameter can be used to handles meshes with multiple connected components.
Geometry Shape Types
Vortex® features a wide range of collision geometries.
This section lists the different geometry shapes or types in Vortex, these types are directly editable in the Vortex Studio Editor.
The important factors in choosing the right geometry are listed here:
- Some geometries are smooth and others are not. The smooth geometries, such as spheres and capsules, result in smoother collisions, particularly when objects are in continuous contact. For example, a wheel that is not smooth will not provide a smooth ride. Use smooth geometries whenever possible.
- Collision detection is considerably faster when using the primitive geometries, rather than full meshes. Use primitives like boxes, spheres, and cylinders whenever possible, in preference to meshes or convex meshes, particularly if the speed of the simulation is important.
- In cases where matching the graphical mesh to the collision mesh is important, use the triangle mesh type. Note that meshes are collections of triangles and will not be smooth, and that collision with meshes can be less efficient.
Box
A primitive box-shaped collision geometry. It is parameterized by specifying height, width, and depth as well as its position and orientation. The Box provides very fast intersection testing but isn't smooth. This can be a problem, for example, when a box is pushed into a corner, since the contact normals along the edges of the box, or at a corner, may jitter between faces, and cause noticeable anomalies. To minimize this, it is best to use boxes only when it is clear that such problems will not arise. |
Capsule
A primitive capsule-shaped collision geometry. It is parameterized by specifying a position, a length, and a radius. It is similar to a cylinder but with two half-spheres at each end. The capsule axis is oriented along its z-axis. To set the dimensions of the capsule: |
Convex Mesh
The ConvexMesh class provides convex mesh collision geometry.
The fatness radius allows the simplification and rounding of the mesh features. The display of such a mesh is left to the user's responsibility.
For many purposes, it is better to use primitives like spheres and cylinders for collision: for example, a mesh tire would be too bumpy to roll properly. However, convex meshes are frequently useful for complex objects whose shape does not match any primitive very well, but which are roughly convex in shape and for which triangle meshes would be more costly.
Cylinder
A primitive cylindrical collision geometry. It is parameterized by specifying a length and radius as well as the position and orientation. The cylinder axis is oriented along its z-axis. The Cylinder provides very fast intersection testing and is useful for modeling wheels or similar rolling objects. |
Height Field
A three-dimensional implicit surface is created by a two-dimensional grid where each cell has an elevation value.
A Heightfield geometry represents a simple way of creating non-flat terrain. It is a regular grid where each point has a given height, specified by a matrix of heights.
Plane
Stretches to infinity in all directions. A plane can be used for many purposes, such as providing a low-cost floor on which to build a simulation. You can specify the position and orientation of a plane. By default, the initial plane is the XY plane, centered at (0,0,0) and pointing toward positive z. |
Sphere
A primitive geometry that is parameterized by specifying a radius about the z-axis. Spheres are attractive collision primitives because they are smooth, and collision detection between a sphere and most other primitive and mesh types is very fast. |
Triangle Mesh
Defines a triangle mesh collision geometry used for complex objects whose shape does not match primitive shapes such as spheres and boxes. Simulating these geometries is taxing on the system, so use them sparingly. Like convex meshes, it is often better to use primitives like spheres and cylinders for collision as primitive collision is faster. However, meshes are frequently necessary for complex objects or objects that have intricate interactions with other objects.