6#include "physxnode/qphysxactorbody_p.h"
10#include <extensions/PxPrismaticJoint.h>
14#include <foundation/PxSimpleTypes.h>
19
20
21
22
23
24
25
26
27
28
29
30
31
32
35
36
37
38
39
40
41
42
43
44
47
48
49
50
51
52
53
54
55
56
58physx::PxJoint *QPrismaticJoint::createPhysxJoint(physx::PxRigidActor *actorA,
59 physx::PxRigidActor *actorB,
60 const physx::PxTransform &trfA,
61 const physx::PxTransform &trfB)
63 return physx::PxPrismaticJointCreate(*StaticPhysXObjects::getReference().physics, actorA, trfA,
67void QPrismaticJoint::setJointProperties()
69 physx::PxPrismaticJoint *joint =
static_cast<physx::PxPrismaticJoint *>(m_joint);
70 const physx::PxTolerancesScale scale =
71 StaticPhysXObjects::getReference().physics->getTolerancesScale();
72 const float lowerLimit = qMin(m_lowerLimit, m_upperLimit);
73 const float upperLimit = qMax(m_lowerLimit, m_upperLimit);
74 joint->setLimit(physx::PxJointLinearLimitPair(scale, lowerLimit, upperLimit));
75 joint->setPrismaticJointFlag(physx::PxPrismaticJointFlag::eLIMIT_ENABLED,
true);
78float QPrismaticJoint::lowerLimit()
const
83void QPrismaticJoint::setLowerLimit(
float newLowerLimit)
85 newLowerLimit = qBound(-PX_MAX_F32, newLowerLimit, PX_MAX_F32);
86 if (qFuzzyCompare(m_lowerLimit, newLowerLimit))
88 m_lowerLimit = newLowerLimit;
89 m_dirtyProperties =
true;
90 emit lowerLimitChanged();
93float QPrismaticJoint::upperLimit()
const
98void QPrismaticJoint::setUpperLimit(
float newUpperLimit)
100 newUpperLimit = qBound(-PX_MAX_F32, newUpperLimit, PX_MAX_F32);
101 if (qFuzzyCompare(m_upperLimit, newUpperLimit))
103 m_upperLimit = newUpperLimit;
104 m_dirtyProperties =
true;
105 emit upperLimitChanged();
#define QT_BEGIN_NAMESPACE