As mentioned above, CollisionBehavior objects can be used to control other aspects of contact beyond friction and enabling. This may be done by setting the CollisionBehavior properties listed below. Except where otherwise indicated, these properties are also exported by the collision manager, where they can be used to provide global default settings for all collisions.
In addition to these properties, CollisionBehavior and CollisionManager export other properties that can be used to control the rendering of collisions, as described in Section 7.5.
A boolean that determines if collisions are enabled. Not present in the collision manager.
A double giving the coefficient of Coulomb friction, typically in the range . The default value is 0. Setting friction to a non-zero value increases the simulation time, since extra constraints must be added to the system to accommodate the friction.
An instance of CollisionBehavior.Method that controls how the contact constraints for the collision response are generated. The methods, described in more detail in Section 7.4.1, are:
|CONTOUR_REGION||constraints generated from planes fit to each mesh contact region|
|VERTEX_PENETRATION||constraints generated from penetrating vertices|
|VERTEX_EDGE_PENETRATION||constraints generated from penetrating vertices and edge-edge contacts|
|DEFAULT||method is determined automatically|
|INACTIVE||no constraints generated|
The default value is DEFAULT.
An instance of CollisionBehavior.VertexPenetrations that controls the collidables for which vertex penetrations are computed when using vertex penetration contact (see Sections 220.127.116.11 and 18.104.22.168). The default value is AUTO.
A boolean which causes the system to handle vertex penetration contact using bilateral constraints instead of unilateral constraints. This usually improves computational performance significantly for collisions involving FEM models, but may result in overconstrained contact when vertex penetration contact is used between rigid bodies, as well as in some other circumstances (Section 7.6). The default value is true.
An instance of CollisionManager.ColliderType that specifies the underlying mechanism used to determine the collision information between two meshes. The choice of collider may restrict which collision methods (described above) are allowed. Collider types are described in more detail in Section 7.4.1 and include:
|AJL_CONTOUR||uses mesh intersection contour to find penetrating regions and vertices|
|TRI_INTERSECTION||uses triangle intersections to find penetrating regions and vertices|
|SIGNED_DISTANCE||uses a signed distance field to find penetrating vertices|
The default value is TRI_INTERSECTION.
A boolean which, if true, indicates that the system should try to reduce the number of contacts between bodies in order to try and remove redundant contacts. See Section 7.6. The default value is false.
A double which adds a compliance (inverse stiffness) to the collision behavior, so that the contact has a “springiness”. See Section 7.6. The default value for this is 0 (no compliance).
A double which, if compliance is non-zero, specifies a damping to accompany the compliant behavior. See Section 7.6. The default value is 0. When compliance is specified, it is usually necessary to set the damping to a non-zero value to prevent bouncing.
A double which, if non-zero, is used to regularize friction constraints. The default value is 0. It is usually only necessary to set this number when MechModel’s useImplicitFriction property is set to true (see Section 7.9.4), and when the contact constraints are redundant (Section 7.6). The number should be interpreted as a small “creep” speed with which contacts nominally held still by static friction are allowed to drift. The number should be as large as possible without seriously affecting the simulation.
A composite property of type ContactForceBehavior specifying a contact force behavior, as described in Section 7.7.2. The default value is null.
A double controlling the amount of interpenetration that is permitted in order to ensure contact stability (see Section 7.9). This property is not present in the collision manager. If unspecified, the system will inherit this property from the MechModel, which computes a default penetration tolerance based on the overall size of the model.
A double which, for the CONTOUR_REGION contact method and the TRI_INTERSECTION collider type, specifies an overlap factor that is used to group individual triangle intersections into contact regions. If not explicitly specified, the system computes a default value based on the overall size of the model.
A double which, for the CONTOUR_REGION contact method, specifies a minimum distance between contact points that is used to reduce the number of contacts. If not explicitly specified, the system computes a default value for this based on the overall size of the model.
To set properties globally in the collision manager, one can access it using the MechModel method getCollisionManager(), and then employ a code fragment such as the following:
Since collision behaviors are subcomponents of the collision manager, properties set in the collision manager will be inherited by any behaviors for which they have not been explicitly set.
One can also set properties using the GUI, by selecting the collision manager or a collision behavior in the navigation panel and then selecting Edit properties ... from the context menu. See “Property panels” and “Collision handling” in the ArtiSynth User Interface Guide.
To set properties for specific collidable pairs, one can call either setDefaultCollisionBehavior() orsetCollisionBehavior() with an appropriately set CollisionBehavior object:
For behaviors that are already set, one may use getDefaultCollisionBehavior() or getCollisionBehavior() to obtain the behavior and then set the desired properties directly:
Note however that getDefaultCollisionBehavior() only works for Collidable.Rigid, Collidable.Deformable, and Collidable.Self, and that getCollisionBehavior() only works for a collidable pair that has been previously specified with setCollisionBehavior(). One may also use getActingCollisionBehavior() (described above) to obtain the behavior (default or otherwise) responsible for a specific pair of collidables, although in some instances no such single behavior exists and the method will then return null.
There are two constructors for CollisionBehavior:
The first creates a behavior with the enabled property set to false and other properties set to their default (generally inherited) values. The second creates a behavior with the enabled and friction properties explicitly specified, and other properties set to their defaults. If mu is less than zero or enabled is false, then the friction property is set to be inherited so that its value is controlled by the global friction property in the collision manager (and accessed using the MechModel methods setFriction(mu) and getFriction()).
Each collidable component maintains a collidable property, which specifically enables or disables the ability of that collidable to collide with other collidables.
The collidable property value is of the enumerated type Collidable.Collidability and has four possible settings:
All collisions disabled: the collidable will not collide with anything.
All collisions (both internal and external) enabled: the collidable may collide with any other collidable.
The collidable may only collide with other collidables that are inside the same collidable hierarchy of some compound collidable (Section 7.3.2).
The collidable may collide with any other collidable except those that are inside the same collidable hierarchy of some compound collidable.
Note that collidability only enables collisions. In order for collisions to actually occur between two collidables, a default or override collision behavior must also be specified for them in the MechModel.