vrdPhysicsConvexConfig

class vrdPhysicsConvexConfig

(Inherits vrdPhysicsHullConfig)

The configuration class for physics objects produced by convex decomposition.

This configuration class is used to specify the properties of physics objects that are produced by convex decomposition. Convex decomposition is a process that takes a complex mesh and breaks it down into a set of convex hulls that approximate the original mesh. This is useful for creating physics objects from non convex meshes that are more precise than a simple convex hull. If possible, this should be prefered over the use of triangle meshes.

The library used for convex decomposition is the v-hacd library (Hierarchical Approximate Convex Decomposition): https://github.com/kmammou/v-hacd. Its documentation contains more information about the parameters that can be set in this configuration class. Almost all of its parameters are exposded here and can be set in this class to fine-tune the decomposition process

Functions

vrdPhysicsConvexConfig.getAsync()

Check if running asynchronously is enabled.

Returns:True if running asynchronously is enabled, false otherwise.
Return type:bool
vrdPhysicsConvexConfig.getFillMode()

Get the fill mode.

Returns:The fill mode.
Return type:integer
vrdPhysicsConvexConfig.getMaxNumberOfConvexHulls()

Get the maximum number of convex hulls allowed.

Returns:The maximum number of convex hulls.
Return type:integer
vrdPhysicsConvexConfig.getMaxNumVerticesPerHull()

Get the maximum number of vertices per convex hull.

Returns:The maximum number of vertices per convex hull.
Return type:integer
vrdPhysicsConvexConfig.getMaxRecursionDepth()

Get the maximum recursion depth.

Returns:The maximum recursion depth.
Return type:integer
vrdPhysicsConvexConfig.getMinEdgeLength()

Get the minimum edge length.

Returns:The minimum edge length.
Return type:integer
vrdPhysicsConvexConfig.getMinimumVolumePercentErrorAllowed()

Get the minimum volume percent error allowed.

Returns:The minimum volume percent error.
Return type:float
vrdPhysicsConvexConfig.getResolution()

Get the voxel resolution.

Returns:The voxel resolution.
Return type:integer
vrdPhysicsConvexConfig.getShrinkWrap()

Check if shrinkwrapping is enabled.

Returns:True if shrinkwrapping is enabled, false otherwise.
Return type:bool
vrdPhysicsConvexConfig.setAsync(mode)

Set whether to run asynchronously.

The default value is ‘true’.

Parameters:mode (bool) – The state indicating whether to run asynchronously.
vrdPhysicsConvexConfig.setFillMode(mode)

Set the fill mode.

The fill mode specifies which algorithm is used by the v-hacd library to fill the insid of the voxelized mesh. The possible values are (from the v-hacd documentation): 0: Flood fill mode. This is the default behavior, after the voxelization step it uses a flood fill to determine ‘inside’ from ‘outside’. However, meshes with holes can fail and create hollow results. 1: Surface only mode. Only consider the ‘surface’, will create ‘skins’ with hollow centers. 2: Raycast fill mode. Uses raycasting to determine inside from outside.

The default value is 0.

Parameters:mode (integer) – The fill mode.
vrdPhysicsConvexConfig.setMaxNumberOfConvexHulls(numHulls)

Set the maximum number of convex hulls that the algorithm will produce.

The algorithm will not produce more hulls than this number. The actual number of hulls produced can be lower than this upper threshold.

The default value is 64.

Parameters:numHulls (integer) – The maximum number of convex hulls.
vrdPhysicsConvexConfig.setMaxNumVerticesPerHull(numVertices)

Set the maximum number of vertices per convex hull.

The number of vertices per convex hull is limited to 256 by PhysX, so the value must be between 4 and 256. It will be adapted to the nearest valid value if it is not.

The default value is 64.

Parameters:numVertices (integer) – The maximum number of vertices per convex hull.
vrdPhysicsConvexConfig.setMaxRecursionDepth(depth)

Set the maximum recursion depth.

This sets the maximum recursion depth for the convex decomposition algorithm. The default value is 10.

Parameters:depth (integer) – The maximum recursion depth.
vrdPhysicsConvexConfig.setMinEdgeLength(length)

Set the minimum edge length.

From the v-hacd documentation: “Once a voxel patch has an edge length of less than 4 on all 3 sides, we don’t keep recursing.”

The default value is 2.

Parameters:length (integer) – The minimum edge length.
vrdPhysicsConvexConfig.setMinimumVolumePercentErrorAllowed(percent)

Set the minimum volume percent error allowed.

From the v-hacd documentation: “If the voxels are within 1% of the volume of the hull, we consider this a close enough approximation”

The default value is 1.0.

Parameters:percent (float) – The minimum volume percent error.
vrdPhysicsConvexConfig.setResolution(resolution)

Set the voxel resolution to use.

The default value is 400000.

Parameters:resolution (integer) – The voxel resolution.
vrdPhysicsConvexConfig.setShrinkWrap(enable)

Set whether to shrinkwrap the voxel positions to the source mesh.

From the v-hacd documentation: “Whether or not to shrinkwrap the voxel positions to the source mesh on output.”

The default value is ‘true’.

Parameters:enable (bool) – The state indicating whether to shrinkwrap.