DynamicRigidBody QML Type

A physical body that can move or be moved. 更多...

导入语句: import QtQuick3D.Physics
Since: Qt 6.4
继承:

PhysicsBody

特性

方法

详细描述

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.

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

特性文档编制

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:

常量 描述
DynamicRigidBody.None No axis lock (default value).
DynamicRigidBody.LockX Lock X axis.
DynamicRigidBody.LockY Lock Y axis.
DynamicRigidBody.LockZ Lock Z axis.

centerOfMassPosition : vector3d

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

另请参阅 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 被设为 DynamicRigidBody.MassAndInertiaTensor .

另请参阅 massMode and inertiaTensor .


density : float

This property defines the density of the body. This is only used when massMode 被设为 DynamicRigidBody.CustomDensity .

Default value is 0.001 .

Range: (0, inf]

另请参阅 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 被设为 DynamicRigidBody.MassAndInertiaMatrix .

另请参阅 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 代替。

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 被设为 DynamicRigidBody.MassAndInertiaTensor .

Default value is (1, 1, 1).

另请参阅 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 特性。

另请参阅 kinematicPosition , kinematicRotation , kinematicEulerRotation ,和 kinematicPivot .


[since 6.5] kinematicEulerRotation : vector4d

Defines the euler rotation of the object when it is kinematic, i.e. when isKinematic 被设为 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.

另请参阅 isKinematic , kinematicPosition , kinematicEulerRotation, and kinematicPivot .


[since 6.5] kinematicPivot : vector3d

Defines the pivot of the object when it is kinematic, i.e. when isKinematic 被设为 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.

另请参阅 isKinematic , kinematicPosition , kinematicEulerRotation ,和 kinematicRotation .


[since 6.5] kinematicPosition : vector3d

Defines the position of the object when it is kinematic, i.e. when isKinematic 被设为 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.

另请参阅 isKinematic , kinematicRotation , kinematicEulerRotation ,和 kinematicPivot .


[since 6.5] kinematicRotation : vector3d

Defines the rotation of the object when it is kinematic, i.e. when isKinematic 被设为 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.

另请参阅 isKinematic , kinematicPosition , kinematicEulerRotation ,和 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:

常量 描述
DynamicRigidBody.None No axis lock (default value).
DynamicRigidBody.LockX Lock X axis.
DynamicRigidBody.LockY Lock Y axis.
DynamicRigidBody.LockZ Lock Z axis.

mass : float

This property defines the mass of the body. Note that this is only used when massMode 不是 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]

另请参阅 massMode .


massMode : MassMode

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

默认情况下, DynamicRigidBody.DefaultDensity 被使用。

Available options:

常量 描述
DynamicRigidBody.DefaultDensity Use the density specified in the defaultDensity property in PhysicsWorld to calculate mass and inertia assuming a uniform density.
DynamicRigidBody.CustomDensity Use specified density in the specified in the density to calculate mass and inertia assuming a uniform density.
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.

方法文档编制

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 )

设置 angularVelocity of the body.


setLinearVelocity ( vector3d linearVelocity )

设置 linearVelocity of the body.

内容