Menu
Lumberyard
User Guide (Version 1.13)

Rigid Body Physics

Use the Rigid Body Physics component to represent solid objects that move realistically when touched, such as a ball. You can use a Rigid Body Physics component with a Primitive Collider or Mesh Collider component to provide geometry for a physical entity.

The Rigid Body Physics component has the following properties:

Enabled Initially

If selected, the entity is initially enabled in the physics simulation

Specify mass or density

Whether total mass is specified, or calculated at spawn time based on density and volume.

Density (kg/cubic meter)

Mass in kg per cubic meter of the mesh's volume. Total mass of entity is calculated at spawn. Water's density is 1000.

This property is only available when: Specify mass or density is set to Density.

At rest initially

If selected, entity remains at rest until it is agitated. If deselected, entity falls after it spawns.

Collision response

If selected, the entity's simulation is affected normally as a result of collisions with other bodies. If deselected, collision events are reported, but the entity's simulation is not affected by simulations.

Interacts with triggers

Whether the entity will interact with the Trigger Area component.

Record collisions

Whether OnCollision events will be sent out on the entity's PhysicsComponentNotificationBus.

Number of collisions

Maximum number of collisions to record and report per frame.

Simulation

Damping

Uniform damping value applied to object's movement.

Minimum energy

The energy threshold under which the object will go to sleep.

Buoyancy

Water damping

Uniform damping value applied while in water.

Water density

Water density strength.

Water resistance

Water resistance strength.

Ebus Request Bus Interface

Use the following request functions with the PhysicsComponentRequestBus interface to communicate with other components of your game.

For more information about using the Event Bus (EBus) interface, see Working with the Event Bus (EBus) System.

EnablePhysics

Makes the entity a participant in the physics simulation.

Parameters

None

Return

None

Scriptable

Yes

DisablePhysics

Stops the entity from participating in the physics simulation.

Parameters

None

Return

None

Scriptable

Yes

IsPhysicsEnabled

Queries whether the entity's physics component has been enabled.

Parameters

None

Return

Bool – whether physics is enabled

Scriptable

Yes

AddImpulse

Adds an impulse to the entity.

Parameters

Vector3 – an impulse in world space

Return

None

Scriptable

Yes

AddImpulseAtPoint

Adds an impulse to the entity at a specified point.

Parameters

Vector3 – an impulse in world space

Vector3 – world space point at which impulse is applied. Specify a zero Vector3 to apply at center of mass.

Return

None

Scriptable

Yes

AddAngularImpulse

Adds an angular impulse to the entity.

Parameters

Vector3 – angular impulse to add

Return

None

Scriptable

Yes

AddAngularImpulseAtPoint

Adds an angular impulse to the entity at a specified point.

Parameters

Vector3 – an angular impulse in world space

Vector3 – world space pivot around which to apply the impulse. Specify a zero Vector3 to apply around center of mass.

Return

None

Scriptable

Yes

GetVelocity

Gets the velocity of the entity.

Parameters

None

Return

Vector3 – velocity of the entity to set

Scriptable

Yes

SetVelocity

Sets the velocity of the entity.

Parameters

Vector3 – world space velocity to set directly on the entity

Return

None

Scriptable

Yes

GetAcceleration

Gets the acceleration of the entity.

Parameters

None

Return

Vector3 – acceleration of the entity

Scriptable

Yes

GetAngularVelocity

Gets the angular velocity of the entity.

Parameters

None

Return

Vector3 – angular velocity of the entity

Scriptable

Yes

SetAngularVelocity

Sets the angular velocity of the entity.

Parameters

Vector3 – world-space angular velocity to directly set on the entity

Return

None

Scriptable

Yes

GetAngularAcceleration

Gets the angular acceleration of the entity.

Parameters

None

Return

Vector3 – world space angular velocity of the entity

Scriptable

Yes

GetMass

Gets the total mass (kg) of the entity.

Parameters

None

Return

float – the total mass of the entity

Scriptable

Yes

SetMass

Sets the total mass (kg) of the entity.

Parameters

float – the total mass to set

Return

None

Scriptable

Yes

GetDensity

Gets the density of the entity, in kg/m3, (Volume / Mass). Water density affects the way objects interact with other objects and float in the water (they sink if their density is more than that of the water).

Parameters

None

Return

float – density of the entity

Scriptable

Yes

SetDensity

Sets the density of the entity, in kg/m3.

Parameters

float – density of the entity to set

Return

None

Scriptable

Yes

GetDamping

Gets the simulation damping coefficient of the entity.

Parameters

None

Return

float – damping coefficient

Scriptable

Yes

SetDamping

Sets entity's damping coefficient for simulation.

Parameters

float - entity's damping coefficient for simulation

Return

None

Scriptable

Yes

GetMinEnergy

Gets the minimum kinetic energy below which the entity should fall asleep.

Parameters

None

Return

float – minimum kinetic energy

Scriptable

Yes

SetMinEnergy

Set the entity's minimum kinetic energy below which the entity should fall asleep

Parameters

float – minimum kinetic energy to set

Return

float – minimum kinetic energy

Scriptable

Yes

GetWaterDamping

Get the entity's uniform damping coefficient while submerged in water.

Parameters

float – minimum kinetic energy to set

Return

None

Scriptable

Yes

SetWaterDamping

Sets the entity's uniform damping coefficient while submerged in water. A cheaper alternative/addition to water resistance (applies uniform damping when in water). Sets the strength of the damping on an object's movement as soon as it is situated underwater. Most objects can work with 0 damping. If an object has trouble coming to rest, try values like 0.2-0.3. Values of 0.5 and higher appear visually as overdamping. Note that when several objects are in contact, the highest damping is used for the entire group.

Parameters

float – Damping coefficient to set

Return

None

Scriptable

Yes

GetWaterDensity

Gets the entity's density applied when it interacts with water.

Parameters

None

Return

float – entity's density while in water

Scriptable

Yes

SetWaterDensity

Sets the entity's density applied when it interacts with water. This can be used to override the default water density (1000). Lower values assume that the body is floating in the water that's less dense than it actually is, and thus it will sink easier. (100..1000) This parameter could be used to specify that the object's physical geometry can leak. For instance, ground vehicles usually have quite large geometry volumes, but they are not waterproof, thus Archimedean force acting on them will be less than submerged_volume 1000 (with 1000 being the actual density underwater). Decreasing per object effective water density will allow such objects to sink (as they would in reality) while still having large-volume physical geometry. Important note : If you are changing the default value of 1000, it is highly recommended that you also change water_resistance in the same way; a rule of thumb might be to always keep them equal.

Parameters

float – entity's density while in water

Return

None

Scriptable

Yes

GetWaterResistance

Gets the entity's medium resistance while it's in water.

Parameters

None

Return

float – entity's medium resistance while in water

Scriptable

Yes

SetWaterResistance

Sets the entity's medium resistance while it's in water. Can be used to override the default water resistance (1000). Sets how strongly the water affects the body (this applies to both water flow and neutral state). (0..2000) Water resistance coefficient. If non-0, precise water resistance is calculated. Otherwise, only water_damping (proportional to the submerged volume) is used to uniformly damp the movement. The former is somewhat slower, but not prohibitively, so it is advised to always set the water resistance. Although water resistance is not too visible on a general object, setting it to a suitable value will prevent very light objects from jumping in the water, and water flow will affect things more realistically. Note that water damping is used regardless of whether water resistance is 0, so it is better to set damping to 0 when resistance is turned on.

Parameters

float – entity's medium resistance while in water

Return

None

Scriptable

Yes