DynamicRigidBody QML Type

A physical body that can move or be moved. More...

Import Statement: import QtQuick3D.Physics
Since: Qt 6.4
Inherits:

PhysicsBody

Properties

Methods

Detailed Description

This type defines a dynamic rigid body: an object that is part of the physics scene and behaves like a physical object with mass and velocity.

Note: triangle mesh, height field and plane geometry shapes are not allowed as collision shapes when isKinematic is false.

Property Documentation

angularAxisLock : AxisLock

This property locks the angular velocity of the body along the axes defined by the DynamicRigidBody.AxisLock enum. To lock several axes just bitwise-or their enum values.

Available options:

ConstantDescription
DynamicRigidBody.NoneNo axis lock (default value).
DynamicRigidBody.LockXLock X axis.
DynamicRigidBody.LockYLock Y axis.
DynamicRigidBody.LockZLock 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.CustomDensity.

Default value is 0.001.

Range: (0, inf]

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. Note that to move and rotate the kinematic object you need to use the kinematicPosition, kinematicRotation, kinematicEulerRotation and kinematicPivot properties.

See also kinematicPosition, kinematicRotation, kinematicEulerRotation, and kinematicPivot.


kinematicEulerRotation : vector4d [since 6.5]

Defines the euler rotation of the object when it is kinematic, i.e. when isKinematic is set to true. On each iteration of the simulation the physical object will be updated according to this value.

This property was introduced in Qt 6.5.

See also isKinematic, kinematicPosition, kinematicEulerRotation, and kinematicPivot.


kinematicPivot : vector3d [since 6.5]

Defines the pivot of the object when it is kinematic, i.e. when isKinematic is set to true. On each iteration of the simulation the physical object will be updated according to this value.

This property was introduced in Qt 6.5.

See also isKinematic, kinematicPosition, kinematicEulerRotation, and kinematicRotation.


kinematicPosition : vector3d [since 6.5]

Defines the position of the object when it is kinematic, i.e. when isKinematic is set to true. On each iteration of the simulation the physical object will be updated according to this value.

This property was introduced in Qt 6.5.

See also isKinematic, kinematicRotation, kinematicEulerRotation, and kinematicPivot.


kinematicRotation : vector3d [since 6.5]

Defines the rotation of the object when it is kinematic, i.e. when isKinematic is set to true. On each iteration of the simulation the physical object will be updated according to this value.

This property was introduced in Qt 6.5.

See also isKinematic, kinematicPosition, kinematicEulerRotation, and kinematicPivot.


linearAxisLock : AxisLock

This property locks the linear velocity of the body along the axes defined by the DynamicRigidBody.AxisLock enum. To lock several axes just bitwise-or their enum values.

Available options:

ConstantDescription
DynamicRigidBody.NoneNo axis lock (default value).
DynamicRigidBody.LockXLock X axis.
DynamicRigidBody.LockYLock Y axis.
DynamicRigidBody.LockZLock Z axis.

mass : float

This property defines the mass of the body. Note that this is only used when massMode is not DynamicRigidBody.CustomDensity or DynamicRigidBody.DefaultDensity. Also note that a value of 0 is interpreted as infinite mass and that negative numbers are not allowed.

Default value is 1.

Range: [0, inf]

See also massMode.


massMode : MassMode

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

By default, DynamicRigidBody.DefaultDensity is used.

Available options:

ConstantDescription
DynamicRigidBody.DefaultDensityUse the density specified in the defaultDensity property in PhysicsWorld to calculate mass and inertia assuming a uniform density.
DynamicRigidBody.CustomDensityUse specified density in the specified in the density to calculate mass and inertia assuming a uniform density.
DynamicRigidBody.MassUse the specified mass to calculate inertia assuming a uniform density.
DynamicRigidBody.MassAndInertiaTensorUse the specified mass value and inertia tensor.
DynamicRigidBody.MassAndInertiaMatrixUse the specified mass value and calculate inertia from the specified inertia matrix.

Method Documentation

applyCentralForce(vector3d force)

Applies a force on the center of the body.


applyCentralImpulse(vector3d impulse)

Applies an impulse on the center of the body.


applyForce(vector3d force, vector3d position)

Applies a force at a position on the body.


applyImpulse(vector3d impulse, vector3d position)

Applies an impulse at a position on the body.


applyTorque(vector3d torque)

Applies a torque on the body.


applyTorqueImpulse(vector3d impulse)

Applies a torque impulse on the body.


reset(vector3d position, vector3d eulerRotation)

Resets the body's position and eulerRotation.


setAngularVelocity(vector3d angularVelocity)

Sets the angularVelocity of the body.


setLinearVelocity(vector3d linearVelocity)

Sets the linearVelocity of the body.