00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef PX_JOINTCONSTRAINT_H
00031 #define PX_JOINTCONSTRAINT_H
00032
00036 #include "foundation/PxTransform.h"
00037 #include "PxRigidActor.h"
00038 #include "PxConstraint.h"
00039 #include "common/PxBase.h"
00040
00041 #if !PX_DOXYGEN
00042 namespace physx
00043 {
00044 #endif
00045
00046 class PxRigidActor;
00047 class PxScene;
00048 class PxPhysics;
00049 class PxConstraint;
00050
00056 struct PxJointConcreteType
00057 {
00058 enum Enum
00059 {
00060 eSPHERICAL = PxConcreteType::eFIRST_PHYSX_EXTENSION,
00061 eREVOLUTE,
00062 ePRISMATIC,
00063 eFIXED,
00064 eDISTANCE,
00065 eD6,
00066 eCONTACT,
00067 eLast
00068 };
00069 };
00070
00071 PX_DEFINE_TYPEINFO(PxJoint, PxConcreteType::eUNDEFINED)
00072 PX_DEFINE_TYPEINFO(PxD6Joint, PxJointConcreteType::eD6)
00073 PX_DEFINE_TYPEINFO(PxDistanceJoint, PxJointConcreteType::eDISTANCE)
00074 PX_DEFINE_TYPEINFO(PxContactJoint, PxJointConcreteType::eCONTACT)
00075 PX_DEFINE_TYPEINFO(PxFixedJoint, PxJointConcreteType::eFIXED)
00076 PX_DEFINE_TYPEINFO(PxPrismaticJoint, PxJointConcreteType::ePRISMATIC)
00077 PX_DEFINE_TYPEINFO(PxRevoluteJoint, PxJointConcreteType::eREVOLUTE)
00078 PX_DEFINE_TYPEINFO(PxSphericalJoint, PxJointConcreteType::eSPHERICAL)
00079
00080
00087 struct PxJointActorIndex
00088 {
00089 enum Enum
00090 {
00091 eACTOR0,
00092 eACTOR1,
00093 COUNT
00094 };
00095 };
00096
00101 class PxJoint : public PxBase
00102 {
00103
00104
00105
00106
00107
00108
00109 public:
00110
00121 virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) = 0;
00122
00131 virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const = 0;
00132
00143 virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0;
00144
00154 virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const = 0;
00155
00162 virtual PxTransform getRelativeTransform() const = 0;
00163
00170 virtual PxVec3 getRelativeLinearVelocity() const = 0;
00171
00177 virtual PxVec3 getRelativeAngularVelocity() const = 0;
00178
00189 virtual void setBreakForce(PxReal force, PxReal torque) = 0;
00190
00199 virtual void getBreakForce(PxReal& force, PxReal& torque) const = 0;
00200
00208 virtual void setConstraintFlags(PxConstraintFlags flags) = 0;
00209
00218 virtual void setConstraintFlag(PxConstraintFlag::Enum flag, bool value) = 0;
00219
00227 virtual PxConstraintFlags getConstraintFlags() const = 0;
00228
00236 virtual void setInvMassScale0(PxReal invMassScale) = 0;
00237
00245 virtual PxReal getInvMassScale0() const = 0;
00246
00254 virtual void setInvInertiaScale0(PxReal invInertiaScale) = 0;
00255
00263 virtual PxReal getInvInertiaScale0() const = 0;
00264
00272 virtual void setInvMassScale1(PxReal invMassScale) = 0;
00273
00281 virtual PxReal getInvMassScale1() const = 0;
00282
00290 virtual void setInvInertiaScale1(PxReal invInertiaScale) = 0;
00291
00299 virtual PxReal getInvInertiaScale1() const = 0;
00300
00308 virtual PxConstraint* getConstraint() const = 0;
00309
00320 virtual void setName(const char* name) = 0;
00321
00329 virtual const char* getName() const = 0;
00330
00336 virtual void release() = 0;
00337
00345 virtual PxScene* getScene() const = 0;
00346
00347 void* userData;
00348
00349
00350
00354 static void getBinaryMetaData(PxOutputStream& stream);
00355
00356
00357
00358 protected:
00359 virtual ~PxJoint() {}
00360
00361
00362
00366 PX_INLINE PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
00367
00371 PX_INLINE PxJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
00372
00376 virtual bool isKindOf(const char* name) const { return !::strcmp("PxJoint", name) || PxBase::isKindOf(name); }
00377
00378
00379 };
00380
00381 class PxSpring
00382 {
00383
00384
00385
00386
00387
00388
00389 public:
00390
00391 PxReal stiffness;
00392 PxReal damping;
00393
00394 PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {}
00395 };
00396
00397
00398 #if !PX_DOXYGEN
00399 }
00400 #endif
00401
00416 PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis);
00417
00419 #endif