IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

DynamicRigidBody QML Type

A physical body that can move or be moved.

This type was introduced in Qt 6.4.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

DynamicRigidBody QML Type

  • Import Statement: import QtQuick3D.Physics

  • Since:: Qt 6.4

  • Inherits:: PhysicsBody

I. 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.

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

II. Property Documentation

 

II-1. 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:

Constant

Description

DynamicRigidBody.None

No axis lock (default value).

DynamicRigidBody.LockX

Lock X axis.

DynamicRigidBody.LockY

Lock Y axis.

DynamicRigidBody.LockZ

Lock Z axis.

II-2. 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.

II-2-1. See Also

II-3. 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.

II-3-1. See Also

II-4. 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]

II-4-1. See Also

See also massMode

II-5. gravityEnabled : bool

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

II-6. 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.

II-6-1. See Also

II-7. 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).

II-7-1. See Also

II-8. 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.

II-8-1. See Also

II-9. [since 6.5] kinematicEulerRotation : vector4d

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.

II-9-1. See Also

See also isKinematic, kinematicPosition, kinematicEulerRotation, kinematicPivot

II-10. [since 6.5] kinematicPivot : vector3d

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.

II-10-1. See Also

II-11. [since 6.5] kinematicPosition : vector3d

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.

II-11-1. See Also

II-12. [since 6.5] kinematicRotation : vector3d

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.

II-12-1. See Also

II-13. 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:

Constant

Description

DynamicRigidBody.None

No axis lock (default value).

DynamicRigidBody.LockX

Lock X axis.

DynamicRigidBody.LockY

Lock Y axis.

DynamicRigidBody.LockZ

Lock Z axis.

II-14. 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]

II-14-1. See Also

See also massMode

II-15. 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:

Constant

Description

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.

III. Method Documentation

 

III-1. applyCentralForce(vector3d force)

Applies a force on the center of the body.

III-2. applyCentralImpulse(vector3d impulse)

Applies an impulse on the center of the body.

III-3. applyForce(vector3d force, vector3d position)

Applies a force at a position on the body.

III-4. applyImpulse(vector3d impulse, vector3d position)

Applies an impulse at a position on the body.

III-5. applyTorque(vector3d torque)

Applies a torque on the body.

III-6. applyTorqueImpulse(vector3d impulse)

Applies a torque impulse on the body.

III-7. reset(vector3d position, vector3d eulerRotation)

Resets the body's position and eulerRotation.

III-8. setAngularVelocity(vector3d angularVelocity)

Sets the angularVelocity of the body.

III-9. setLinearVelocity(vector3d linearVelocity)

Sets the linearVelocity of the body.

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+