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 {
28class PxTransform;
29class PxPhysics;
30class PxJoint;
31class PxRigidActor;
32}
33
34QT_BEGIN_NAMESPACE
35
36class QPhysXActorBody;
37
38class Q_QUICK3DPHYSICS_EXPORT QPhysicsJoint : public QObject
39{
41 Q_PROPERTY(QAbstractPhysicsBody *bodyA READ bodyA WRITE setBodyA NOTIFY bodyAChanged FINAL
42 REVISION(6, 12))
43 Q_PROPERTY(QAbstractPhysicsBody *bodyB READ bodyB WRITE setBodyB NOTIFY bodyBChanged FINAL
44 REVISION(6, 12))
45 Q_PROPERTY(QVector3D positionA READ positionA WRITE setPositionA NOTIFY positionAChanged FINAL
46 REVISION(6, 12))
47 Q_PROPERTY(QVector3D positionB READ positionB WRITE setPositionB NOTIFY positionBChanged FINAL
48 REVISION(6, 12))
49 Q_PROPERTY(QQuaternion orientationA READ orientationA WRITE setOrientationA NOTIFY
50 orientationAChanged FINAL REVISION(6, 12))
51 Q_PROPERTY(QQuaternion orientationB READ orientationB WRITE setOrientationB NOTIFY
52 orientationBChanged FINAL REVISION(6, 12))
53 QML_NAMED_ELEMENT(PhysicsJoint)
54 QML_UNCREATABLE("abstract interface")
56public:
57 QPhysicsJoint();
58 ~QPhysicsJoint();
60 Q_REVISION(6, 12) QAbstractPhysicsBody *bodyA() const;
61 Q_REVISION(6, 12) void setBodyA(QAbstractPhysicsBody *newBodyA);
62 Q_REVISION(6, 12) QAbstractPhysicsBody *bodyB() const;
63 Q_REVISION(6, 12) void setBodyB(QAbstractPhysicsBody *newBodyB);
64 Q_REVISION(6, 12) QVector3D positionA() const;
65 Q_REVISION(6, 12) void setPositionA(const QVector3D &newPositionA);
66 Q_REVISION(6, 12) QVector3D positionB() const;
67 Q_REVISION(6, 12) void setPositionB(const QVector3D &newPositionB);
68 Q_REVISION(6, 12) QQuaternion orientationA() const;
69 Q_REVISION(6, 12) void setOrientationA(const QQuaternion &newOrientationA);
70 Q_REVISION(6, 12) QQuaternion orientationB() const;
71 Q_REVISION(6, 12) void setOrientationB(const QQuaternion &newOrientationB);
73 void updatePhysXBackend();
74 physx::PxJoint *getPhysXBackend() const;
77 Q_REVISION(6, 12) void bodyAChanged();
78 Q_REVISION(6, 12) void bodyBChanged();
79 Q_REVISION(6, 12) void positionAChanged();
80 Q_REVISION(6, 12) void positionBChanged();
81 Q_REVISION(6, 12) void orientationAChanged();
82 Q_REVISION(6, 12) void orientationBChanged();
84protected:
85 virtual physx::PxJoint *createPhysxJoint(physx::PxRigidActor *actorA,
86 physx::PxRigidActor *actorB,
87 const physx::PxTransform &trfA,
88 const physx::PxTransform &trfB) = 0;
89 virtual void setJointProperties() = 0;
90 void onBodyDestroyed(QObject *body);
92 QAbstractPhysicsBody *m_bodyA = nullptr;
93 QAbstractPhysicsBody *m_bodyB = nullptr;
94 QVector3D m_positionA;
95 QVector3D m_positionB;
96 QQuaternion m_orientationA;
97 QQuaternion m_orientationB;
98 physx::PxJoint *m_joint = nullptr;
99 bool m_needsRebuild = false; // Set to true when body or orientation is changed
100 bool m_dirtyProperties = false; // Set to true when subclasses properties are updated
101};
102
103QT_END_NAMESPACE
104
105#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