6#include "physxnode/qphysxactorbody_p.h"
10#include <extensions/PxRevoluteJoint.h>
15
16
17
18
19
20
21
22
23
24
25
26
27
30
31
32
33
34
35
36
37
38
39
42
43
44
45
46
47
48
49
50
51
54
55
56
57
58
59
61float QRevoluteJoint::angularLimitLower()
const
63 return m_angularLimitLower;
66void QRevoluteJoint::setAngularLimitLower(
float newAngularLimitLower)
68 newAngularLimitLower = qBound(-2.0f * physx::PxPi, newAngularLimitLower, 2.0f * physx::PxPi);
69 if (qFuzzyCompare(m_angularLimitLower, newAngularLimitLower))
71 m_angularLimitLower = newAngularLimitLower;
72 m_dirtyProperties =
true;
73 emit angularLimitLowerChanged();
76float QRevoluteJoint::angularLimitUpper()
const
78 return m_angularLimitUpper;
81void QRevoluteJoint::setAngularLimitUpper(
float newAngularLimitUpper)
83 newAngularLimitUpper = qBound(-2.0f * physx::PxPi, newAngularLimitUpper, 2.0f * physx::PxPi);
84 if (qFuzzyCompare(m_angularLimitUpper, newAngularLimitUpper))
86 m_angularLimitUpper = newAngularLimitUpper;
87 m_dirtyProperties =
true;
88 emit angularLimitUpperChanged();
91bool QRevoluteJoint::enableAngularLimit()
const
93 return m_enableAngularLimit;
96void QRevoluteJoint::setEnableAngularLimit(
bool newEnableAngularLimit)
98 if (m_enableAngularLimit == newEnableAngularLimit)
100 m_enableAngularLimit = newEnableAngularLimit;
101 m_dirtyProperties =
true;
102 emit enableAngularLimitChanged();
105physx::PxJoint *QRevoluteJoint::createPhysxJoint(physx::PxRigidActor *actorA,
106 physx::PxRigidActor *actorB,
107 const physx::PxTransform &trfA,
108 const physx::PxTransform &trfB)
110 return physx::PxRevoluteJointCreate(*StaticPhysXObjects::getReference().physics, actorA, trfA,
114void QRevoluteJoint::setJointProperties()
116 physx::PxRevoluteJoint *joint =
static_cast<physx::PxRevoluteJoint *>(m_joint);
117 const float lower = qMin(m_angularLimitLower, m_angularLimitUpper);
118 const float upper = qMax(m_angularLimitLower, m_angularLimitUpper);
119 joint->setLimit(physx::PxJointAngularLimitPair(lower, upper));
120 joint->setRevoluteJointFlag(physx::PxRevoluteJointFlag::eLIMIT_ENABLED, m_enableAngularLimit);
#define QT_BEGIN_NAMESPACE