Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qjoint_p.h
Go to the documentation of this file.
1// Copyright (C) 2026 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4#ifndef PHYSICSJOINT_H
5#define PHYSICSJOINT_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtQuick3DPhysics/qtquick3dphysicsglobal.h>
19#include <QtQuick3DPhysics/private/qabstractphysicsbody_p.h>
20#include <qobjectdefs.h>
21#include <qqmlintegration.h>
22#include <qtmetamacros.h>
23#include <QtQml/QQmlEngine>
24
25#include <QString>
26
27namespace physx {
28template<class Type>
29class PxTransformT;
30typedef PxTransformT<float> PxTransform;
31class PxPhysics;
32class PxJoint;
33class PxRigidActor;
34}
35
36QT_BEGIN_NAMESPACE
37
38class QPhysXActorBody;
39
40class Q_QUICK3DPHYSICS_EXPORT QPhysicsJoint : public QObject
41{
43 Q_PROPERTY(QAbstractPhysicsBody *bodyA READ bodyA WRITE setBodyA NOTIFY bodyAChanged FINAL
44 REVISION(6, 12))
45 Q_PROPERTY(QAbstractPhysicsBody *bodyB READ bodyB WRITE setBodyB NOTIFY bodyBChanged FINAL
46 REVISION(6, 12))
47 Q_PROPERTY(QVector3D positionA READ positionA WRITE setPositionA NOTIFY positionAChanged FINAL
48 REVISION(6, 12))
49 Q_PROPERTY(QVector3D positionB READ positionB WRITE setPositionB NOTIFY positionBChanged FINAL
50 REVISION(6, 12))
51 Q_PROPERTY(QQuaternion orientationA READ orientationA WRITE setOrientationA NOTIFY
52 orientationAChanged FINAL REVISION(6, 12))
53 Q_PROPERTY(QQuaternion orientationB READ orientationB WRITE setOrientationB NOTIFY
54 orientationBChanged FINAL REVISION(6, 12))
55 QML_NAMED_ELEMENT(PhysicsJoint)
56 QML_UNCREATABLE("abstract interface")
58public:
59 QPhysicsJoint();
60 ~QPhysicsJoint();
62 Q_REVISION(6, 12) QAbstractPhysicsBody *bodyA() const;
63 Q_REVISION(6, 12) void setBodyA(QAbstractPhysicsBody *newBodyA);
64 Q_REVISION(6, 12) QAbstractPhysicsBody *bodyB() const;
65 Q_REVISION(6, 12) void setBodyB(QAbstractPhysicsBody *newBodyB);
66 Q_REVISION(6, 12) QVector3D positionA() const;
67 Q_REVISION(6, 12) void setPositionA(const QVector3D &newPositionA);
68 Q_REVISION(6, 12) QVector3D positionB() const;
69 Q_REVISION(6, 12) void setPositionB(const QVector3D &newPositionB);
70 Q_REVISION(6, 12) QQuaternion orientationA() const;
71 Q_REVISION(6, 12) void setOrientationA(const QQuaternion &newOrientationA);
72 Q_REVISION(6, 12) QQuaternion orientationB() const;
73 Q_REVISION(6, 12) void setOrientationB(const QQuaternion &newOrientationB);
75 void updatePhysXBackend();
76 physx::PxJoint *getPhysXBackend() const;
79 Q_REVISION(6, 12) void bodyAChanged();
80 Q_REVISION(6, 12) void bodyBChanged();
81 Q_REVISION(6, 12) void positionAChanged();
82 Q_REVISION(6, 12) void positionBChanged();
83 Q_REVISION(6, 12) void orientationAChanged();
84 Q_REVISION(6, 12) void orientationBChanged();
86protected:
87 virtual physx::PxJoint *createPhysxJoint(physx::PxRigidActor *actorA,
88 physx::PxRigidActor *actorB,
89 const physx::PxTransform &trfA,
90 const physx::PxTransform &trfB) = 0;
91 virtual void setJointProperties() = 0;
92 void onBodyDestroyed(QObject *body);
94 QAbstractPhysicsBody *m_bodyA = nullptr;
95 QAbstractPhysicsBody *m_bodyB = nullptr;
96 QVector3D m_positionA;
97 QVector3D m_positionB;
98 QQuaternion m_orientationA;
99 QQuaternion m_orientationB;
100 physx::PxJoint *m_joint = nullptr;
101 bool m_needsRebuild = false; // Set to true when body or orientation is changed
102 bool m_dirtyProperties = false; // Set to true when subclasses properties are updated
103};
104
105QT_END_NAMESPACE
106
107#endif // PHYSICSJOINT_H
Combined button and popup list for selecting options.
#define QML_UNCREATABLE(REASON)
#define QML_NAMED_ELEMENT(NAME)
#define QT_BEGIN_NAMESPACE
#define QT_END_NAMESPACE
#define Q_PROPERTY(...)
#define Q_OBJECT
#define Q_REVISION(...)
#define signals
#define emit