18. Contacts
When two Shapes are in contact, AGX Dynamics automatically generate contact points for these. The contact points are given to the AGX Dynamics solver during Simulation stepping.
The generation of contact points can to some extent be manipulated by the user.
Examples of this is using Collision Groups to disable contact generation between certain Shapes or setting the Contact Reduction Level
in a Contact Material
.
18.1. Contacts Rendering
By enabling the Draw Shape Contacts
setting in Edit > Project Settings... > Plugins > AGX Dynamics > Debug
, all contact points will be rendered on the screen each frame.
This can be helpful for quicly inspecting contact behaviours between objects in a Simulation. Note that this operation is computationally intensive, meaning it should be turned off whenever performance is important.
The Draw Shape Contacts
setting can also be enabled or disabled at runtime by setting it in the AGX Simulation object:
The contact point rendering is mainly a debugging and inspection tool and is not avaiable in built applications built with Shipping
configuration.
For more control over contacts, for rendering or other operations, contact points can be accessed from Blueprint or C++, see Accessing Contact Points.
18.2. Accessing Contact Points
Below, examples of how to access contact points in Blueprints are shown. Accessing contact points from C++ is also supported.
To access contact points for a specific Shape, simply call the GetShapeContacts
function on it.
To access all contact points in the Simulation, call the GetShapeContacts
on the AGX Simulation
object.