# 7. RigidBody¶

The RigidBodyComponent infuses dynamics into an Actor. It signals that something is to be simulated with AGX Dynamics. A RigidBodyComponent has a set of properties, see description and screenshot below, and can be further configured by adding shapes components beneath it in the Component tree.

Property

Unit

Description

Default

Mass

$$kg$$

The mass of the rigid body.

1.0

Inertia Tensor Diagonal

$$kg \cdot m^2$$

Inertia tensor of the rigid body.

(1.0, 1.0, 1.0)

Velocity

$$cm/s$$

Initial linear velocity.

(0.0, 0.0, 0.0)

Angular Velocity

$$degrees/s$$

Initial angular velocity.

(0.0, 0.0, 0.0)

Motion Control

Static, Kinematic, Dynamic

Whether the body should be static (never move, fixed in the world), kinematic (moved with a fixed velocity, not influenced by forces), or dynamic (fully simulated).

Dynamic

Transform Root Component

Boolean

Whether updated transformations after each time step should be applied to the RigidBodyComponent or the owning actor’s RootComponent.

False

A single Actor may contain multiple instances of RigidBodyComponent. This means that the Actor contains multiple independent simulated objects. This is a mental model that is different from, but just as valid as, the mental model where the Actor is the simulated object. Consider a falling box and a vehicle. In the falling box case, the Actor contains a single RigidBodyComponent and the Actor and the RigidBodyComponent represents the same thing, a falling box. In this case the Actor’s transformation should be updated from the simulation. In the vehicle case there is not a single RigidBodyComponent but a collection of them, but the entire vehicle is still a single Actor. The constituent bodies can have different velocities, for example wheels turning and doors opening, and we cannot apply all these new transformations to the actor at the end of a simulation step. Which of the two cases a particular RigidBodyComponent represents is selected with the Transform Root Component checkbox. If checked, then the RigidBodyComponent and the Actor represents the same thing and we’re in a falling box kind of scenario. If Transform Root Component is unchecked then the RigidBodyComponent transformation is kept separate from the Actor’s transformation and we’re in the vehicle kind of scenario. There should be no more than a single RigidBodyComponent within an Actor that has the Transform Root Component property checked.

A RigidBodyComponent has no shape of it’s own, it has no volume. To give it one we add ShapeComponents to it. Any ShapeComponents that are in the RigidBodyComponent’s attachment subtree make up the shape of the rigid body.

# 8. Creating Rigid Bodies¶

The RigidBodyComponent are created using the Add Component button in the Details Panel.

When moving things in the viewport, always ensure that the right component within the selected actor is being moved. A common mistake is to move a body or a shape when the intention was to move the entire Actor.

## 8.1. Rigid Body with primitive shapes¶

Let’s create a wheel starting from an empty actor and adding a Rigid Body Component, a Cylinder Shape Component and a Box Shape Component.

Check that the DefaultSceneRoot has its Mobility set to Movable and that Motion Control on the Rigid Body Component is set to Dynamics. On the Rigid Body Component we enabled Transform Root Component. AGX Dynamics for Unreal supports multiple Rigid Bodies per actor so normally the plugin only updates the Rigid Body Component’s transform from the underlying AGX Dynamics simulation. With Transform Root Component checked the transformation synchronization is done on the actor’s Root Component instead of on the Rigid Body Component. For the two shape components we use the properties in the AGX Shape category to specify the dimensions of each Shape and we use the Location attribute to position the Box on the surface of the Cylinder.