9. Constraints¶

Constraints represent geometrical relationships between bodies. For example, a door hanging in its frame with hinges can be modeled in a simulation with one or several constraint. A tire attached to a wheel hub is another example where a constraint can be used.

The image below show two boxes constrained using a Hinge Constraint.

10. Creating Constraints¶

Constraints can be created in the same way as Rigid Bodies and Shapes are created, by adding Components to Actors. Another way to create Constraints is through the constraint creation wizard found in the AGX Dynamics Mode.

Select the type of constraint to create, the bodies that should be constrained, and the way attachment frames should be computed. For the example, create a Hinge Constraint having a wheel as it’s first body and leave the second body blank. This will constrain the wheel to the world.

Orange circles are rendered to indicate the constrained bodies when an actor containing one or more constraints is selected. When a constraint component is selected in the Details Panel then the full constraint gizmo is rendered. The constraint gizmo is a visualization of both the constraint frame and the free degree(s) of freedom, if any, as arrows. A Hinge has one free rotational axis, which can be seen in the image below.

10.1. Secondary Constraints¶

To enable motors, friction controllers and more, one can enable one or several of the Secondary Constraints of a Constraint Component. This is done from the AGX Secondary Constraint category of the Details Panel when the Constraint component is selected.

Below is an example where the Target Speed Controller is enabled and set to a speed of 100 degrees per second.

11. Graphical Representation Settings¶

All Constraints have graphical representations, i.e. are rendered to the screen when an actor containing one or several Constraints is selected. These renderings are scaled in such a way that they keep a constant size as measured on the screen. This behavior is similar to the regular transformation gizmo. To keep these renderings from cluttering the screen when moving far away from a selected Actor, a maximum distance within which this scaling is active, is available as a plugin setting. To change this setting, select Edit > Project Settings... > Plugins > AGX Dynamics and in the category Rendering change the value of Constraint Visualization Scaling Distance Max.