# DynamicRigidBody QML Type

Dynamic rigid body. More...

Import Statement: | import QtQuick3DPhysics |

Since: | Qt 6.4 |

Inherits: |

## Properties

**angularVelocity**: vector3d**axisLockAngularX**: bool**axisLockAngularY**: bool**axisLockAngularZ**: bool**axisLockLinearX**: bool**axisLockLinearY**: bool**axisLockLinearZ**: bool**centerOfMassPosition**: vector3d**centerOfMassRotation**: quaternion**density**: float**gravityEnabled**: bool**inertiaMatrix**: list<float>**inertiaTensor**: vector3d**isKinematic**: bool**linearVelocity**: vector3d**mass**: float**massMode**: MassMode

## Methods

**applyCentralForce**(vector3d*force*)**applyCentralImpulse**(vector3d*impulse*)**applyForce**(vector3d*force*, vector3d*position*)**applyImpulse**(vector3d*impulse*, vector3d*position*)**applyTorque**(vector3d*torque*)**applyTorqueImpulse**(vector3d*impulse*)**reset**(vector3d*position*, vector3d*eulerRotation*)

## Detailed Description

This is the dynamic rigid body. A dynamic rigid body is an object that is part of the physics scene and behaves like a physical object with mass and velocity. Note that triangle mesh, heightfield and plane geometry shapes are only allowed as collision shapes when isKinematic is `true`

.

## Property Documentation

angularVelocity : vector3d |

This property defines the angular velocity of the body.

axisLockAngularX : bool |

This property locks the angular velocity of the body along the X-axis.

axisLockAngularY : bool |

This property locks the angular velocity of the body along the Y-axis.

axisLockAngularZ : bool |

This property locks the angular velocity of the body along the Z-axis.

axisLockLinearX : bool |

This property locks the linear velocity of the body along the X-axis.

axisLockLinearY : bool |

This property locks the linear velocity of the body along the Y-axis.

axisLockLinearZ : bool |

This property locks the linear velocity of the body along the Z-axis.

centerOfMassPosition : vector3d |

Defines the position of the center of mass relative to the body. Note that this is only used when massMode is set to `DynamicRigidBody.MassAndInertiaTensor`

.

**See also **massMode and inertiaTensor.

centerOfMassRotation : quaternion |

Defines the rotation of the center of mass pose, i.e. it specifies the orientation of the body's principal inertia axes relative to the body. Note that this is only used when massMode is set to `DynamicRigidBody.MassAndInertiaTensor`

.

**See also **massMode and inertiaTensor.

density : float |

This property defines the density of the body. This is only used when massMode is set to `DynamicRigidBody.Density`

. When this property is less than or equal to zero, this body will use the defaultDensity value.

Default value is `-1`

.

**See also **massMode.

gravityEnabled : bool |

This property defines whether the object is going to be affected by gravity or not.

inertiaMatrix : list<float> |

Defines the inertia tensor matrix. This is a 3x3 matrix in column-major order. Note that this matrix is expected to be diagonalizable. Note that this is only used when massMode is set to `DynamicRigidBody.MassAndInertiaMatrix`

.

**See also **massMode and inertiaTensor.

inertiaTensor : vector3d |

Defines the inertia tensor vector, using a parameter specified in mass space coordinates.

This is the diagonal vector of a 3x3 diagonal matrix, if you have a non diagonal world/actor space inertia tensor then you should use inertiaMatrix instead.

The inertia tensor components must be positive and a value of 0 in any component is interpreted as infinite inertia along that axis. Note that this is only used when massMode is set to `DynamicRigidBody.MassAndInertiaTensor`

.

Default value is (1, 1, 1).

**See also **massMode and inertiaMatrix.

isKinematic : bool |

This property defines whether the object is kinematic or not. A kinematic object does not get influenced by external forces and can be seen as an object of infinite mass. If this property is set then in every simulation frame the physical object will be moved to its target position regardless of external forces.

linearVelocity : vector3d |

This property defines the linear velocity of the body.

mass : float |

massMode : MassMode |

This property holds the enum which describes how mass and inertia are calculated for this body.

By default, `DynamicRigidBody.Density`

is used.

Available options:

Constant | Description |
---|---|

`DynamicRigidBody.Density` | Use the specified density to calculate mass and inertia assuming a uniform density. If density is non-positive then the defaultDensity property in DynamicsWorld is used. |

`DynamicRigidBody.Mass` | Use the specified mass to calculate inertia assuming a uniform density. |

`DynamicRigidBody.MassAndInertiaTensor` | Use the specified mass value and inertia tensor. |

`DynamicRigidBody.MassAndInertiaMatrix` | Use the specified mass value and calculate inertia from the specified inertia matrix. |

## Method Documentation

applyCentralForce(vector3d |

Applies a *force* on the center of the body.

applyCentralImpulse(vector3d |

Applies an *impulse* on the center of the body.

applyTorque(vector3d |

Applies a *torque* on the body.

applyTorqueImpulse(vector3d |

Applies a torque *impulse* on the body.

© 2023 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.