42 QQmlListProperty<QAbstractCollisionShape> collisionShapes READ collisionShapes CONSTANT)
43 Q_PROPERTY(
bool sendContactReports READ sendContactReports WRITE setSendContactReports NOTIFY
44 sendContactReportsChanged)
45 Q_PROPERTY(
bool receiveContactReports READ receiveContactReports WRITE setReceiveContactReports
46 NOTIFY receiveContactReportsChanged)
47 Q_PROPERTY(
bool sendTriggerReports READ sendTriggerReports WRITE setSendTriggerReports NOTIFY
48 sendTriggerReportsChanged REVISION(6, 5))
49 Q_PROPERTY(
bool receiveTriggerReports READ receiveTriggerReports WRITE setReceiveTriggerReports
50 NOTIFY receiveTriggerReportsChanged REVISION(6, 5))
51 Q_PROPERTY(
int filterGroup READ filterGroup WRITE setfilterGroup NOTIFY filterGroupChanged
53 Q_PROPERTY(
int filterIgnoreGroups READ filterIgnoreGroups WRITE setFilterIgnoreGroups NOTIFY
54 filterIgnoreGroupsChanged REVISION(6, 7));
56 QML_NAMED_ELEMENT(PhysicsNode)
57 QML_UNCREATABLE(
"abstract interface")
59 QAbstractPhysicsNode();
60 ~QAbstractPhysicsNode() override;
62 QQmlListProperty<QAbstractCollisionShape> collisionShapes();
63 const QVector<QAbstractCollisionShape *> &getCollisionShapesList()
const;
65 void updateFromPhysicsTransform(
const physx::PxTransform &transform);
67 void registerContact(QAbstractPhysicsNode *body,
const QVector<QVector3D> &positions,
68 const QVector<QVector3D> &impulses,
const QVector<QVector3D> &normals);
70 bool sendContactReports()
const;
71 void setSendContactReports(
bool sendContactReports);
73 bool receiveContactReports()
const;
74 void setReceiveContactReports(
bool receiveContactReports);
76 Q_REVISION(6, 5)
bool sendTriggerReports()
const;
77 Q_REVISION(6, 5)
void setSendTriggerReports(
bool sendTriggerReports);
79 Q_REVISION(6, 5)
bool receiveTriggerReports()
const;
80 Q_REVISION(6, 5)
void setReceiveTriggerReports(
bool receiveTriggerReports);
82 bool hasStaticShapes()
const {
return m_hasStaticShapes; }
84 virtual QAbstractPhysXNode *createPhysXBackend() = 0;
86 Q_REVISION(6, 7)
int filterGroup()
const;
87 Q_REVISION(6, 7)
void setfilterGroup(
int newfilterGroup);
89 Q_REVISION(6, 7)
int filterIgnoreGroups()
const;
90 Q_REVISION(6, 7)
void setFilterIgnoreGroups(
int newFilterIgnoreGroups);
93 QFilterData filterData()
const;
96 void onShapeDestroyed(QObject *object);
97 void onShapeNeedsRebuild(QObject *object);
100 void bodyContact(QAbstractPhysicsNode *body,
const QVector<QVector3D> &positions,
101 const QVector<QVector3D> &impulses,
const QVector<QVector3D> &normals);
102 void sendContactReportsChanged(
float sendContactReports);
103 void receiveContactReportsChanged(
float receiveContactReports);
104 Q_REVISION(6, 5)
void sendTriggerReportsChanged(
float sendTriggerReports);
105 Q_REVISION(6, 5)
void receiveTriggerReportsChanged(
float receiveTriggerReports);
106 Q_REVISION(6, 5)
void enteredTriggerBody(QAbstractPhysicsNode *body);
107 Q_REVISION(6, 5)
void exitedTriggerBody(QAbstractPhysicsNode *body);
108 Q_REVISION(6, 7)
void filterGroupChanged();
109 Q_REVISION(6, 7)
void filterIgnoreGroupsChanged();
112 static void qmlAppendShape(QQmlListProperty<QAbstractCollisionShape> *list,
113 QAbstractCollisionShape *shape);
114 static QAbstractCollisionShape *qmlShapeAt(QQmlListProperty<QAbstractCollisionShape> *list,
116 static qsizetype qmlShapeCount(QQmlListProperty<QAbstractCollisionShape> *list);
117 static void qmlClearShapes(QQmlListProperty<QAbstractCollisionShape> *list);
119 QVector<QAbstractCollisionShape *> m_collisionShapes;
120 bool m_shapesDirty =
false;
121 bool m_sendContactReports =
false;
122 bool m_receiveContactReports =
false;
123 bool m_sendTriggerReports =
false;
124 bool m_receiveTriggerReports =
false;
125 bool m_hasStaticShapes =
false;
126 int m_filterGroup = 0;
127 int m_filterIgnoreGroups = 0;
128 bool m_filtersDirty =
false;
130 friend class QPhysicsJoint;
131 friend class QAbstractPhysXNode;
132 friend class QPhysicsWorld;
133 friend class SimulationEventCallback;
134 QAbstractPhysXNode *m_backendObject =
nullptr;
void updateFilters(QPhysXWorld *physX) override
void markDirtyShapes() override
void buildShapes(QPhysXWorld *physX)
void rebuildDirtyShapes(QPhysicsWorld *world, QPhysXWorld *physX) override
void init(QPhysicsWorld *world, QPhysXWorld *physX) override
void detachFrontend() override
bool debugGeometryCapability() override
void cleanup(QPhysXWorld *physX) override
physx::PxRigidActor * actor
virtual void createActor(QPhysXWorld *physX)
void sync(float deltaTime, QHash< QQuick3DNode *, QMatrix4x4 > &transformCache) override
physx::PxTransform getGlobalPose() override