Qt 6.x
The Qt SDK
Loading...
Searching...
No Matches
QDynamicRigidBody Class Reference

#include <qrigidbody_p.h>

+ Inheritance diagram for QDynamicRigidBody:
+ Collaboration diagram for QDynamicRigidBody:

Public Types

enum class  MassMode {
  DefaultDensity , CustomDensity , Mass , MassAndInertiaTensor ,
  MassAndInertiaMatrix
}
 
enum  AxisLock { LockNone = 0 , LockX = 1 , LockY = 2 , LockZ = 4 }
 
- Public Types inherited from QQuick3DNode
enum  TransformSpace { LocalSpace , ParentSpace , SceneSpace }
 
enum  StaticFlags { None }
 

Signals

void massChanged (float mass)
 
void densityChanged (float density)
 
void isKinematicChanged (bool isKinematic)
 
 Q_REVISION (6, 5) void linearAxisLockChanged()
 
 Q_REVISION (6, 5) void angularAxisLockChanged()
 
void gravityEnabledChanged ()
 
void massModeChanged ()
 
void inertiaTensorChanged ()
 
void centerOfMassPositionChanged ()
 
void centerOfMassRotationChanged ()
 
void inertiaMatrixChanged ()
 
 Q_REVISION (6, 5) void kinematicPositionChanged(const QVector3D &kinematicPosition)
 
 Q_REVISION (6, 5) void kinematicRotationChanged(const QQuaternion &kinematicRotation)
 
 Q_REVISION (6, 5) void kinematicEulerRotationChanged(const QVector3D &kinematicEulerRotation)
 
 Q_REVISION (6, 5) void kinematicPivotChanged(const QVector3D &kinematicPivot)
 
- Signals inherited from QAbstractPhysicsBody
void physicsMaterialChanged ()
 
- Signals inherited from QAbstractPhysicsNode
void bodyContact (QAbstractPhysicsNode *body, const QVector< QVector3D > &positions, const QVector< QVector3D > &impulses, const QVector< QVector3D > &normals)
 
void sendContactReportsChanged (float sendContactReports)
 
void receiveContactReportsChanged (float receiveContactReports)
 
 Q_REVISION (6, 5) void sendTriggerReportsChanged(float sendTriggerReports)
 
 Q_REVISION (6, 5) void receiveTriggerReportsChanged(float receiveTriggerReports)
 
 Q_REVISION (6, 5) void enteredTriggerBody(QAbstractPhysicsNode *body)
 
 Q_REVISION (6, 5) void exitedTriggerBody(QAbstractPhysicsNode *body)
 
- Signals inherited from QQuick3DNode
void xChanged ()
 
void yChanged ()
 
void zChanged ()
 
void rotationChanged ()
 
void eulerRotationChanged ()
 
void positionChanged ()
 
void scaleChanged ()
 
void pivotChanged ()
 
void localOpacityChanged ()
 
void visibleChanged ()
 
void forwardChanged ()
 
void upChanged ()
 
void rightChanged ()
 
void sceneTransformChanged ()
 
void scenePositionChanged ()
 
void sceneRotationChanged ()
 
void sceneScaleChanged ()
 
void staticFlagsChanged ()
 
- Signals inherited from QQuick3DObject
void parentChanged ()
 
void childrenChanged ()
 
void stateChanged ()
 
- Signals inherited from QObject
void destroyed (QObject *=nullptr)
 This signal is emitted immediately before the object obj is destroyed, after any instances of QPointer have been notified, and cannot be blocked.
 
void objectNameChanged (const QString &objectName, QPrivateSignal)
 This signal is emitted after the object's name has been changed.
 

Public Member Functions

 QDynamicRigidBody ()
 \qmltype DynamicRigidBody \inqmlmodule QtQuick3D.Physics \inherits PhysicsBody
 
 ~QDynamicRigidBody ()
 
float mass () const
 
void setMass (float mass)
 
float density () const
 
void setDensity (float density)
 
bool isKinematic () const
 
void setIsKinematic (bool isKinematic)
 
 Q_REVISION (6, 5) AxisLock linearAxisLock() const
 
 Q_REVISION (6, 5) void setLinearAxisLock(AxisLock new AxisLockLinear)
 
 Q_REVISION (6, 5) AxisLock angularAxisLock() const
 
 Q_REVISION (6, 5) void setAngularAxisLock(AxisLock new AxisLockAngular)
 
bool gravityEnabled () const
 
void setGravityEnabled (bool gravityEnabled)
 
Q_INVOKABLE void applyCentralForce (const QVector3D &force)
 
Q_INVOKABLE void applyForce (const QVector3D &force, const QVector3D &position)
 
Q_INVOKABLE void applyTorque (const QVector3D &torque)
 
Q_INVOKABLE void applyCentralImpulse (const QVector3D &impulse)
 
Q_INVOKABLE void applyImpulse (const QVector3D &impulse, const QVector3D &position)
 
Q_INVOKABLE void applyTorqueImpulse (const QVector3D &impulse)
 
Q_INVOKABLE void setAngularVelocity (const QVector3D &angularVelocity)
 
Q_INVOKABLE void setLinearVelocity (const QVector3D &linearVelocity)
 
Q_INVOKABLE void reset (const QVector3D &position, const QVector3D &eulerRotation)
 
QQueue< QPhysicsCommand * > & commandQueue ()
 
void updateDefaultDensity (float defaultDensity)
 
MassMode massMode () const
 
void setMassMode (const MassMode newMassMode)
 
const QVector3DinertiaTensor () const
 
void setInertiaTensor (const QVector3D &newInertiaTensor)
 
const QVector3DcenterOfMassPosition () const
 
void setCenterOfMassPosition (const QVector3D &newCenterOfMassPosition)
 
const QQuaternioncenterOfMassRotation () const
 
void setCenterOfMassRotation (const QQuaternion &newCenterOfMassRotation)
 
const QList< float > & readInertiaMatrix () const
 
void setInertiaMatrix (const QList< float > &newInertiaMatrix)
 
const QMatrix3x3inertiaMatrix () const
 
 Q_REVISION (6, 5) void setKinematicPosition(const QVector3D &position)
 
 Q_REVISION (6, 5) QVector3D kinematicPosition() const
 
 Q_REVISION (6, 5) void setKinematicRotation(const QQuaternion &rotation)
 
 Q_REVISION (6, 5) QQuaternion kinematicRotation() const
 
 Q_REVISION (6, 5) void setKinematicEulerRotation(const QVector3D &rotation)
 
 Q_REVISION (6, 5) QVector3D kinematicEulerRotation() const
 
 Q_REVISION (6, 5) void setKinematicPivot(const QVector3D &pivot)
 
 Q_REVISION (6, 5) QVector3D kinematicPivot() const
 
- Public Member Functions inherited from QAbstractPhysicsBody
 QAbstractPhysicsBody ()
 \qmltype PhysicsBody \inherits PhysicsNode \inqmlmodule QtQuick3D.Physics
 
QPhysicsMaterialphysicsMaterial () const
 
void setPhysicsMaterial (QPhysicsMaterial *newPhysicsMaterial)
 
- Public Member Functions inherited from QAbstractPhysicsNode
 QAbstractPhysicsNode ()
 \qmltype PhysicsNode \inherits Node \inqmlmodule QtQuick3D.Physics
 
 ~QAbstractPhysicsNode () override
 
QQmlListProperty< QAbstractCollisionShapecollisionShapes ()
 
const QVector< QAbstractCollisionShape * > & getCollisionShapesList () const
 
void updateFromPhysicsTransform (const physx::PxTransform &transform)
 
void registerContact (QAbstractPhysicsNode *body, const QVector< QVector3D > &positions, const QVector< QVector3D > &impulses, const QVector< QVector3D > &normals)
 
bool sendContactReports () const
 
void setSendContactReports (bool sendContactReports)
 
bool receiveContactReports () const
 
void setReceiveContactReports (bool receiveContactReports)
 
 Q_REVISION (6, 5) bool sendTriggerReports() const
 
 Q_REVISION (6, 5) void setSendTriggerReports(bool sendTriggerReports)
 
 Q_REVISION (6, 5) bool receiveTriggerReports() const
 
 Q_REVISION (6, 5) void setReceiveTriggerReports(bool receiveTriggerReports)
 
bool hasStaticShapes () const
 
- Public Member Functions inherited from QQuick3DNode
 QQuick3DNode (QQuick3DNode *parent=nullptr)
 \qmltype Node \inherits Object3D \inqmlmodule QtQuick3D
 
 ~QQuick3DNode () override
 
float x () const
 \qmlproperty real QtQuick3D::Node::x
 
float y () const
 \qmlproperty real QtQuick3D::Node::y
 
float z () const
 \qmlproperty real QtQuick3D::Node::z
 
QQuaternion rotation () const
 \qmlproperty quaternion QtQuick3D::Node::rotation
 
QVector3D eulerRotation () const
 \qmlproperty vector3d QtQuick3D::Node::eulerRotation
 
QVector3D position () const
 \qmlproperty vector3d QtQuick3D::Node::position
 
QVector3D scale () const
 \qmlproperty vector3d QtQuick3D::Node::scale
 
QVector3D pivot () const
 \qmlproperty vector3d QtQuick3D::Node::pivot
 
float localOpacity () const
 \qmlproperty real QtQuick3D::Node::opacity
 
bool visible () const
 \qmlproperty bool QtQuick3D::Node::visible
 
int staticFlags () const
 \qmlproperty int QtQuick3D::Node::staticFlags
 
QQuick3DNodeparentNode () const
 
QVector3D forward () const
 \qmlproperty vector3d QtQuick3D::Node::forward \readonly
 
QVector3D up () const
 \qmlproperty vector3d QtQuick3D::Node::up \readonly
 
QVector3D right () const
 \qmlproperty vector3d QtQuick3D::Node::right \readonly
 
QVector3D scenePosition () const
 \qmlproperty vector3d QtQuick3D::Node::scenePosition \readonly
 
QQuaternion sceneRotation () const
 \qmlproperty quaternion QtQuick3D::Node::sceneRotation \readonly
 
QVector3D sceneScale () const
 \qmlproperty vector3d QtQuick3D::Node::sceneScale \readonly
 
QMatrix4x4 sceneTransform () const
 \qmlproperty matrix4x4 QtQuick3D::Node::sceneTransform \readonly
 
Q_INVOKABLE void rotate (qreal degrees, const QVector3D &axis, QQuick3DNode::TransformSpace space)
 \qmlmethod QtQuick3D::Node::rotate(real degrees, vector3d axis, enumeration space)
 
Q_INVOKABLE QVector3D mapPositionToScene (const QVector3D &localPosition) const
 \qmlmethod vector3d QtQuick3D::Node::mapPositionToScene(vector3d localPosition)
 
Q_INVOKABLE QVector3D mapPositionFromScene (const QVector3D &scenePosition) const
 \qmlmethod vector3d QtQuick3D::Node::mapPositionFromScene(vector3d scenePosition)
 
Q_INVOKABLE QVector3D mapPositionToNode (const QQuick3DNode *node, const QVector3D &localPosition) const
 \qmlmethod vector3d QtQuick3D::Node::mapPositionToNode(QtQuick3D::Node node, vector3d localPosition)
 
Q_INVOKABLE QVector3D mapPositionFromNode (const QQuick3DNode *node, const QVector3D &localPosition) const
 \qmlmethod vector3d QtQuick3D::Node::mapPositionFromNode(QtQuick3D::Node node, vector3d localPosition)
 
Q_INVOKABLE QVector3D mapDirectionToScene (const QVector3D &localDirection) const
 \qmlmethod vector3d QtQuick3D::Node::mapDirectionToScene(vector3d localDirection)
 
Q_INVOKABLE QVector3D mapDirectionFromScene (const QVector3D &sceneDirection) const
 \qmlmethod vector3d QtQuick3D::Node::mapDirectionFromScene(vector3d sceneDirection)
 
Q_INVOKABLE QVector3D mapDirectionToNode (const QQuick3DNode *node, const QVector3D &localDirection) const
 \qmlmethod vector3d QtQuick3D::Node::mapDirectionToNode(QtQuick3D::Node node, vector3d localDirection)
 
Q_INVOKABLE QVector3D mapDirectionFromNode (const QQuick3DNode *node, const QVector3D &localDirection) const
 \qmlmethod vector3d QtQuick3D::Node::mapDirectionFromNode(QtQuick3D::Node node, vector3d localDirection)
 
void markAllDirty () override
 
- Public Member Functions inherited from QObject
Q_INVOKABLE QObject (QObject *parent=nullptr)
 Constructs an object with parent object parent.
 
virtual ~QObject ()
 Destroys the object, deleting all its child objects.
 
virtual bool event (QEvent *event)
 This virtual function receives events to an object and should return true if the event e was recognized and processed.
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 Filters events if this object has been installed as an event filter for the watched object.
 
QString objectName () const
 
Q_WEAK_OVERLOAD void setObjectName (const QString &name)
 Sets the object's name to name.
 
void setObjectName (QAnyStringView name)
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
QBindable< QStringbindableObjectName ()
 
bool isWidgetType () const
 Returns true if the object is a widget; otherwise returns false.
 
bool isWindowType () const
 Returns true if the object is a window; otherwise returns false.
 
bool isQuickItemType () const
 Returns true if the object is a QQuickItem; otherwise returns false.
 
bool signalsBlocked () const noexcept
 Returns true if signals are blocked; otherwise returns false.
 
bool blockSignals (bool b) noexcept
 If block is true, signals emitted by this object are blocked (i.e., emitting a signal will not invoke anything connected to it).
 
QThreadthread () const
 Returns the thread in which the object lives.
 
void moveToThread (QThread *thread)
 Changes the thread affinity for this object and its children.
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 This is an overloaded function that will start a timer of type timerType and a timeout of interval milliseconds.
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType=Qt::CoarseTimer)
 
void killTimer (int id)
 Kills the timer with timer identifier, id.
 
template<typename T >
findChild (const QString &aName=QString(), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns the child of this object that can be cast into type T and that is called name, or \nullptr if there is no such object.
 
template<typename T >
QList< T > findChildren (const QString &aName, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 Returns all children of this object with the given name that can be cast to type T, or an empty list if there are no such objects.
 
template<typename T >
QList< T > findChildren (Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
 
const QObjectListchildren () const
 Returns a list of child objects.
 
void setParent (QObject *parent)
 Makes the object a child of parent.
 
void installEventFilter (QObject *filterObj)
 Installs an event filter filterObj on this object.
 
void removeEventFilter (QObject *obj)
 Removes an event filter object obj from this object.
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *member, Qt::ConnectionType type=Qt::AutoConnection) const
 
bool disconnect (const char *signal=nullptr, const QObject *receiver=nullptr, const char *member=nullptr) const
 
bool disconnect (const QObject *receiver, const char *member=nullptr) const
 
void dumpObjectTree () const
 Dumps a tree of children to the debug output.
 
void dumpObjectInfo () const
 Dumps information about signal connections, etc.
 
bool setProperty (const char *name, const QVariant &value)
 Sets the value of the object's name property to value.
 
bool setProperty (const char *name, QVariant &&value)
 
QVariant property (const char *name) const
 Returns the value of the object's name property.
 
QList< QByteArraydynamicPropertyNames () const
 
QBindingStoragebindingStorage ()
 
const QBindingStoragebindingStorage () const
 
QObjectparent () const
 Returns a pointer to the parent object.
 
bool inherits (const char *classname) const
 Returns true if this object is an instance of a class that inherits className or a QObject subclass that inherits className; otherwise returns false.
 
- Public Member Functions inherited from QQmlParserStatus
 QQmlParserStatus ()
 
virtual ~QQmlParserStatus ()
 
virtual void classBegin ()=0
 Invoked after class creation, but before any properties have been set.
 
virtual void componentComplete ()=0
 Invoked after the root component that caused this instantiation has completed construction.
 

Properties

float mass
 
float density
 
AxisLock linearAxisLock
 
AxisLock angularAxisLock
 
bool isKinematic
 
bool gravityEnabled
 
MassMode massMode
 
QVector3D inertiaTensor
 
QVector3D centerOfMassPosition
 
QQuaternion centerOfMassRotation
 
QList< float > inertiaMatrix
 
QVector3D kinematicPosition
 
QVector3D kinematicEulerRotation
 
QQuaternion kinematicRotation
 
QVector3D kinematicPivot
 
- Properties inherited from QAbstractPhysicsBody
QPhysicsMaterialphysicsMaterial
 
- Properties inherited from QAbstractPhysicsNode
QQmlListProperty< QAbstractCollisionShapecollisionShapes
 
bool sendContactReports
 
bool receiveContactReports
 
bool sendTriggerReports
 
bool receiveTriggerReports
 
- Properties inherited from QQuick3DNode
float x
 
float y
 
float z
 
QQuaternion rotation
 
QVector3D eulerRotation
 
QVector3D position
 
QVector3D scale
 
QVector3D pivot
 
float opacity
 
bool visible
 
QVector3D forward
 
QVector3D up
 
QVector3D right
 
QVector3D scenePosition
 
QQuaternion sceneRotation
 
QVector3D sceneScale
 
QMatrix4x4 sceneTransform
 
int staticFlags
 
- Properties inherited from QQuick3DObject
QQuick3DObjectparent
 \qmlproperty Object3D QtQuick3D::Object3D::parent This property holds the parent of the Object3D in a 3D scene.
 
- Properties inherited from QObject
QString objectName
 the name of this object
 

Additional Inherited Members

- Public Slots inherited from QQuick3DNode
void setX (float x)
 
void setY (float y)
 
void setZ (float z)
 
void setRotation (const QQuaternion &rotation)
 
void setEulerRotation (const QVector3D &eulerRotation)
 
void setPosition (const QVector3D &position)
 
void setScale (const QVector3D &scale)
 
void setPivot (const QVector3D &pivot)
 
void setLocalOpacity (float opacity)
 
void setVisible (bool visible)
 
void setStaticFlags (int staticFlags)
 
- Public Slots inherited from QQuick3DObject
void update ()
 
void setParentItem (QQuick3DObject *parentItem)
 
- Public Slots inherited from QObject
void deleteLater ()
 \threadsafe
 
- Static Public Member Functions inherited from QObject
static QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
 \threadsafe
 
static QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::ContextTypeForFunctor< Func2 >::ContextType *context, Func2 &&slot, Qt::ConnectionType type=Qt::AutoConnection)
 
template<typename Func1 , typename Func2 >
static QMetaObject::Connection connect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, Func2 &&slot)
 
static bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *member)
 \threadsafe
 
static bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &member)
 
static bool disconnect (const QMetaObject::Connection &)
 Disconnect a connection.
 
template<typename Func1 , typename Func2 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const typename QtPrivate::FunctionPointer< Func2 >::Object *receiver, Func2 slot)
 
template<typename Func1 >
static bool disconnect (const typename QtPrivate::FunctionPointer< Func1 >::Object *sender, Func1 signal, const QObject *receiver, void **zero)
 
- Protected Member Functions inherited from QQuick3DNode
void connectNotify (const QMetaMethod &signal) override
 
void disconnectNotify (const QMetaMethod &signal) override
 
void componentComplete () override
 Invoked after the root component that caused this instantiation has completed construction.
 
 QQuick3DNode (QQuick3DNodePrivate &dd, QQuick3DNode *parent=nullptr)
 
QSSGRenderGraphObjectupdateSpatialNode (QSSGRenderGraphObject *node) override
 
virtual void itemChange (ItemChange, const ItemChangeData &) override
 
- Protected Member Functions inherited from QQuick3DObject
virtual QSSGRenderGraphObjectupdateSpatialNode (QSSGRenderGraphObject *node)
 
virtual void markAllDirty ()
 
virtual void itemChange (ItemChange, const ItemChangeData &)
 
 QQuick3DObject (QQuick3DObjectPrivate &dd, QQuick3DObject *parent=nullptr)
 
void classBegin () override
 Invoked after class creation, but before any properties have been set.
 
void componentComplete () override
 Invoked after the root component that caused this instantiation has completed construction.
 
bool isComponentComplete () const
 
virtual void preSync ()
 
- Protected Member Functions inherited from QObject
QObjectsender () const
 Returns a pointer to the object that sent the signal, if called in a slot activated by a signal; otherwise it returns \nullptr.
 
int senderSignalIndex () const
 
int receivers (const char *signal) const
 Returns the number of receivers connected to the signal.
 
bool isSignalConnected (const QMetaMethod &signal) const
 
virtual void timerEvent (QTimerEvent *event)
 This event handler can be reimplemented in a subclass to receive timer events for the object.
 
virtual void childEvent (QChildEvent *event)
 This event handler can be reimplemented in a subclass to receive child events.
 
virtual void customEvent (QEvent *event)
 This event handler can be reimplemented in a subclass to receive custom events.
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
 QObject (QObjectPrivate &dd, QObject *parent=nullptr)
 
- Protected Attributes inherited from QObject
QScopedPointer< QObjectDatad_ptr
 

Detailed Description

Definition at line 28 of file qrigidbody_p.h.

Member Enumeration Documentation

◆ AxisLock

Enumerator
LockNone 
LockX 
LockY 
LockZ 

Definition at line 40 of file qrigidbody_p.h.

◆ MassMode

enum class QDynamicRigidBody::MassMode
strong
Enumerator
DefaultDensity 
CustomDensity 
Mass 
MassAndInertiaTensor 
MassAndInertiaMatrix 

Definition at line 31 of file qrigidbody_p.h.

Constructor & Destructor Documentation

◆ QDynamicRigidBody()

QT_BEGIN_NAMESPACE QDynamicRigidBody::QDynamicRigidBody ( )
default

\qmltype DynamicRigidBody \inqmlmodule QtQuick3D.Physics \inherits PhysicsBody

Since
6.4

A physical body that can move or be moved.

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
\l{TriangleMeshShape}{triangle mesh}, \l{HeightFieldShape}{height field} and \l{PlaneShape}{plane} geometry shapes are not allowed as collision shapes when \l isKinematic is false.

\qmlproperty float DynamicRigidBody::mass

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

\qmlproperty float DynamicRigidBody::density

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

\qmlproperty AxisLock DynamicRigidBody::linearAxisLock

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:

\value DynamicRigidBody.None No axis lock (default value).

\value DynamicRigidBody.LockX Lock X axis.

\value DynamicRigidBody.LockY Lock Y axis.

\value DynamicRigidBody.LockZ Lock Z axis.

\qmlproperty AxisLock DynamicRigidBody::angularAxisLock

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:

\value DynamicRigidBody.None No axis lock (default value).

\value DynamicRigidBody.LockX Lock X axis.

\value DynamicRigidBody.LockY Lock Y axis.

\value DynamicRigidBody.LockZ Lock Z axis.

\qmlproperty bool DynamicRigidBody::isKinematic 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, kinematicPivot

\qmlproperty bool DynamicRigidBody::gravityEnabled This property defines whether the object is going to be affected by gravity or not.

\qmlproperty MassMode DynamicRigidBody::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:

\value DynamicRigidBody.DefaultDensity Use the density specified in the \l {PhysicsWorld::}{defaultDensity} property in PhysicsWorld to calculate mass and inertia assuming a uniform density.

\value DynamicRigidBody.CustomDensity Use specified density in the specified in the \l {DynamicRigidBody::}{density} to calculate mass and inertia assuming a uniform density.

\value DynamicRigidBody.Mass Use the specified mass to calculate inertia assuming a uniform density.

\value DynamicRigidBody.MassAndInertiaTensor Use the specified mass value and inertia tensor.

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

\qmlproperty vector3d DynamicRigidBody::inertiaTensor

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 \l{DynamicRigidBody::inertiaMatrix}{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, inertiaMatrix

\qmlproperty vector3d DynamicRigidBody::centerOfMassPosition

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, inertiaTensor

\qmlproperty quaternion DynamicRigidBody::centerOfMassRotation

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, inertiaTensor

\qmlproperty list<float> DynamicRigidBody::inertiaMatrix

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, inertiaTensor

\qmlproperty vector3d DynamicRigidBody::kinematicPosition

Since
6.5

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

See also
isKinematic, kinematicRotation, kinematicEulerRotation, kinematicPivot

\qmlproperty vector3d DynamicRigidBody::kinematicRotation

Since
6.5

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

See also
isKinematic, kinematicPosition, kinematicEulerRotation, kinematicPivot

\qmlproperty vector4d DynamicRigidBody::kinematicEulerRotation

Since
6.5

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

See also
isKinematic, kinematicPosition, kinematicEulerRotation, kinematicPivot

\qmlproperty vector3d DynamicRigidBody::kinematicPivot

Since
6.5

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

See also
isKinematic, kinematicPosition, kinematicEulerRotation, kinematicRotation

\qmlmethod DynamicRigidBody::applyCentralForce(vector3d force)

Applies a force on the center of the body.

\qmlmethod DynamicRigidBody::applyForce(vector3d force, vector3d position)

Applies a force at a position on the body.

\qmlmethod DynamicRigidBody::applyTorque(vector3d torque)

Applies a torque on the body.

\qmlmethod DynamicRigidBody::applyCentralImpulse(vector3d impulse)

Applies an impulse on the center of the body.

\qmlmethod DynamicRigidBody::applyImpulse(vector3d impulse, vector3d position)

Applies an impulse at a position on the body.

\qmlmethod DynamicRigidBody::applyTorqueImpulse(vector3d impulse)

Applies a torque impulse on the body.

\qmlmethod DynamicRigidBody::setAngularVelocity(vector3d angularVelocity)

Sets the angularVelocity of the body.

\qmlmethod DynamicRigidBody::setLinearVelocity(vector3d linearVelocity)

Sets the linearVelocity of the body.

\qmlmethod DynamicRigidBody::reset(vector3d position, vector3d eulerRotation)

Resets the body's position and eulerRotation.

◆ ~QDynamicRigidBody()

QDynamicRigidBody::~QDynamicRigidBody ( )

Definition at line 284 of file qrigidbody.cpp.

References QList< T >::clear(), and qDeleteAll().

+ Here is the call graph for this function:

Member Function Documentation

◆ applyCentralForce()

void QDynamicRigidBody::applyCentralForce ( const QVector3D force)

Definition at line 559 of file qrigidbody.cpp.

References QQueue< T >::enqueue().

+ Here is the call graph for this function:

◆ applyCentralImpulse()

void QDynamicRigidBody::applyCentralImpulse ( const QVector3D impulse)

Definition at line 574 of file qrigidbody.cpp.

References QQueue< T >::enqueue().

+ Here is the call graph for this function:

◆ applyForce()

void QDynamicRigidBody::applyForce ( const QVector3D force,
const QVector3D position 
)

Definition at line 564 of file qrigidbody.cpp.

References QQueue< T >::enqueue(), and QQuick3DNode::position.

+ Here is the call graph for this function:

◆ applyImpulse()

void QDynamicRigidBody::applyImpulse ( const QVector3D impulse,
const QVector3D position 
)

Definition at line 579 of file qrigidbody.cpp.

References QQueue< T >::enqueue(), and QQuick3DNode::position.

+ Here is the call graph for this function:

◆ applyTorque()

void QDynamicRigidBody::applyTorque ( const QVector3D torque)

Definition at line 569 of file qrigidbody.cpp.

References QQueue< T >::enqueue().

+ Here is the call graph for this function:

◆ applyTorqueImpulse()

void QDynamicRigidBody::applyTorqueImpulse ( const QVector3D impulse)

Definition at line 584 of file qrigidbody.cpp.

References QQueue< T >::enqueue().

+ Here is the call graph for this function:

◆ centerOfMassPosition()

const QVector3D & QDynamicRigidBody::centerOfMassPosition ( ) const

Definition at line 308 of file qrigidbody.cpp.

◆ centerOfMassPositionChanged

void QDynamicRigidBody::centerOfMassPositionChanged ( )
signal

Referenced by setCenterOfMassPosition().

+ Here is the caller graph for this function:

◆ centerOfMassRotation()

const QQuaternion & QDynamicRigidBody::centerOfMassRotation ( ) const

Definition at line 290 of file qrigidbody.cpp.

◆ centerOfMassRotationChanged

void QDynamicRigidBody::centerOfMassRotationChanged ( )
signal

Referenced by setCenterOfMassRotation().

+ Here is the caller graph for this function:

◆ commandQueue()

QQueue< QPhysicsCommand * > & QDynamicRigidBody::commandQueue ( )

Definition at line 548 of file qrigidbody.cpp.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes().

+ Here is the caller graph for this function:

◆ density()

float QDynamicRigidBody::density ( ) const

Definition at line 474 of file qrigidbody.cpp.

◆ densityChanged

void QDynamicRigidBody::densityChanged ( float  density)
signal

Referenced by setDensity().

+ Here is the caller graph for this function:

◆ gravityEnabled()

bool QDynamicRigidBody::gravityEnabled ( ) const

Definition at line 445 of file qrigidbody.cpp.

◆ gravityEnabledChanged

void QDynamicRigidBody::gravityEnabledChanged ( )
signal

Referenced by setGravityEnabled().

+ Here is the caller graph for this function:

◆ inertiaMatrix()

const QMatrix3x3 & QDynamicRigidBody::inertiaMatrix ( ) const

Definition at line 430 of file qrigidbody.cpp.

◆ inertiaMatrixChanged

void QDynamicRigidBody::inertiaMatrixChanged ( )
signal

Referenced by setInertiaMatrix().

+ Here is the caller graph for this function:

◆ inertiaTensor()

const QVector3D & QDynamicRigidBody::inertiaTensor ( ) const

Definition at line 379 of file qrigidbody.cpp.

◆ inertiaTensorChanged

void QDynamicRigidBody::inertiaTensorChanged ( )
signal

Referenced by setInertiaTensor().

+ Here is the caller graph for this function:

◆ isKinematic()

bool QDynamicRigidBody::isKinematic ( ) const

Definition at line 440 of file qrigidbody.cpp.

◆ isKinematicChanged

void QDynamicRigidBody::isKinematicChanged ( bool  isKinematic)
signal

Referenced by setIsKinematic().

+ Here is the caller graph for this function:

◆ mass()

float QDynamicRigidBody::mass ( ) const

Definition at line 435 of file qrigidbody.cpp.

◆ massChanged

void QDynamicRigidBody::massChanged ( float  mass)
signal

Referenced by setMass().

+ Here is the caller graph for this function:

◆ massMode()

QDynamicRigidBody::MassMode QDynamicRigidBody::massMode ( ) const

Definition at line 337 of file qrigidbody.cpp.

◆ massModeChanged

void QDynamicRigidBody::massModeChanged ( )
signal

Referenced by setMassMode().

+ Here is the caller graph for this function:

◆ Q_REVISION() [1/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const

◆ Q_REVISION() [2/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const

◆ Q_REVISION() [3/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const

◆ Q_REVISION() [4/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const

◆ Q_REVISION() [5/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const

◆ Q_REVISION() [6/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const

◆ Q_REVISION [7/18]

QDynamicRigidBody::Q_REVISION ( ,
 
)
signal

◆ Q_REVISION [8/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &
signal

◆ Q_REVISION [9/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &
signal

◆ Q_REVISION [10/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &
signal

◆ Q_REVISION [11/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &
signal

◆ Q_REVISION [12/18]

QDynamicRigidBody::Q_REVISION ( ,
 
)
signal

◆ Q_REVISION() [13/18]

QDynamicRigidBody::Q_REVISION ( ,
 
)
new

◆ Q_REVISION() [14/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &

◆ Q_REVISION() [15/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &

◆ Q_REVISION() [16/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &

◆ Q_REVISION() [17/18]

QDynamicRigidBody::Q_REVISION ( ,
 
) const &

◆ Q_REVISION() [18/18]

QDynamicRigidBody::Q_REVISION ( ,
 
)
new

◆ readInertiaMatrix()

const QList< float > & QDynamicRigidBody::readInertiaMatrix ( ) const

Definition at line 396 of file qrigidbody.cpp.

◆ reset()

void QDynamicRigidBody::reset ( const QVector3D position,
const QVector3D eulerRotation 
)

Definition at line 594 of file qrigidbody.cpp.

References QQueue< T >::enqueue(), QQuick3DNode::eulerRotation, and QQuick3DNode::position.

+ Here is the call graph for this function:

◆ setAngularVelocity()

void QDynamicRigidBody::setAngularVelocity ( const QVector3D angularVelocity)

Definition at line 517 of file qrigidbody.cpp.

References QQueue< T >::enqueue().

+ Here is the call graph for this function:

◆ setCenterOfMassPosition()

void QDynamicRigidBody::setCenterOfMassPosition ( const QVector3D newCenterOfMassPosition)

Definition at line 313 of file qrigidbody.cpp.

References centerOfMassPositionChanged(), CustomDensity, DefaultDensity, emit, QQueue< T >::enqueue(), Mass, MassAndInertiaMatrix, MassAndInertiaTensor, and qFuzzyCompare().

+ Here is the call graph for this function:

◆ setCenterOfMassRotation()

void QDynamicRigidBody::setCenterOfMassRotation ( const QQuaternion newCenterOfMassRotation)

Definition at line 295 of file qrigidbody.cpp.

References centerOfMassRotationChanged(), emit, QQueue< T >::enqueue(), MassAndInertiaTensor, and qFuzzyCompare().

+ Here is the call graph for this function:

◆ setDensity()

void QDynamicRigidBody::setDensity ( float  density)

Definition at line 479 of file qrigidbody.cpp.

References CustomDensity, density, densityChanged(), emit, QQueue< T >::enqueue(), and qFuzzyCompare().

+ Here is the call graph for this function:

◆ setGravityEnabled()

void QDynamicRigidBody::setGravityEnabled ( bool  gravityEnabled)

Definition at line 507 of file qrigidbody.cpp.

References emit, QQueue< T >::enqueue(), gravityEnabled, and gravityEnabledChanged().

+ Here is the call graph for this function:

◆ setInertiaMatrix()

void QDynamicRigidBody::setInertiaMatrix ( const QList< float > &  newInertiaMatrix)

Definition at line 414 of file qrigidbody.cpp.

References QList< T >::data(), QGenericMatrix< N, M, T >::data(), emit, QQueue< T >::enqueue(), fuzzyEquals(), inertiaMatrixChanged(), QList< T >::length(), MassAndInertiaMatrix, and qMin().

+ Here is the call graph for this function:

◆ setInertiaTensor()

void QDynamicRigidBody::setInertiaTensor ( const QVector3D newInertiaTensor)

Definition at line 384 of file qrigidbody.cpp.

References emit, QQueue< T >::enqueue(), inertiaTensorChanged(), MassAndInertiaTensor, and qFuzzyCompare().

+ Here is the call graph for this function:

◆ setIsKinematic()

void QDynamicRigidBody::setIsKinematic ( bool  isKinematic)

Definition at line 491 of file qrigidbody.cpp.

References emit, QQueue< T >::enqueue(), QAbstractPhysicsNode::hasStaticShapes(), isKinematic, isKinematicChanged(), and qWarning.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setLinearVelocity()

void QDynamicRigidBody::setLinearVelocity ( const QVector3D linearVelocity)

Definition at line 589 of file qrigidbody.cpp.

References QQueue< T >::enqueue().

+ Here is the call graph for this function:

◆ setMass()

void QDynamicRigidBody::setMass ( float  mass)

Definition at line 450 of file qrigidbody.cpp.

References CustomDensity, DefaultDensity, emit, QQueue< T >::enqueue(), Mass, mass, MassAndInertiaMatrix, MassAndInertiaTensor, massChanged(), and qFuzzyCompare().

+ Here is the call graph for this function:

◆ setMassMode()

void QDynamicRigidBody::setMassMode ( const MassMode  newMassMode)

Definition at line 342 of file qrigidbody.cpp.

References CustomDensity, DefaultDensity, emit, QQueue< T >::enqueue(), QPhysicsWorld::getWorld(), Mass, MassAndInertiaMatrix, MassAndInertiaTensor, massModeChanged(), qWarning, and world.

+ Here is the call graph for this function:

◆ updateDefaultDensity()

void QDynamicRigidBody::updateDefaultDensity ( float  defaultDensity)

Definition at line 553 of file qrigidbody.cpp.

References DefaultDensity, and QQueue< T >::enqueue().

Referenced by QPhysXDynamicBody::updateDefaultDensity().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Property Documentation

◆ angularAxisLock

QDynamicRigidBody::AxisLock QDynamicRigidBody::angularAxisLock
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by getLockFlags().

◆ centerOfMassPosition

QVector3D QDynamicRigidBody::centerOfMassPosition
read

◆ centerOfMassRotation

QQuaternion QDynamicRigidBody::centerOfMassRotation
read

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysicsCommandSetMassAndInertiaTensor::execute().

◆ density

float QDynamicRigidBody::density
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes(), and setDensity().

◆ gravityEnabled

bool QDynamicRigidBody::gravityEnabled
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by setGravityEnabled().

◆ inertiaMatrix

QList<float> QDynamicRigidBody::inertiaMatrix
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes().

◆ inertiaTensor

QVector3D QDynamicRigidBody::inertiaTensor
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes().

◆ isKinematic

bool QDynamicRigidBody::isKinematic
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes(), and setIsKinematic().

◆ kinematicEulerRotation

QVector3D QDynamicRigidBody::kinematicEulerRotation
read

Definition at line 205 of file qrigidbody_p.h.

◆ kinematicPivot

QVector3D QDynamicRigidBody::kinematicPivot
readwrite

Definition at line 205 of file qrigidbody_p.h.

◆ kinematicPosition

QVector3D QDynamicRigidBody::kinematicPosition
readwrite

Definition at line 205 of file qrigidbody_p.h.

◆ kinematicRotation

QQuaternion QDynamicRigidBody::kinematicRotation
readwrite

Definition at line 205 of file qrigidbody_p.h.

◆ linearAxisLock

QDynamicRigidBody::AxisLock QDynamicRigidBody::linearAxisLock
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by getLockFlags().

◆ mass

float QDynamicRigidBody::mass
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes(), and setMass().

◆ massMode

MassMode QDynamicRigidBody::massMode
readwrite

Definition at line 205 of file qrigidbody_p.h.

Referenced by QPhysXDynamicBody::rebuildDirtyShapes().


The documentation for this class was generated from the following files: