PxJoint.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3  *
4  * NVIDIA CORPORATION and its licensors retain all intellectual property
5  * and proprietary rights in and to this software, related documentation
6  * and any modifications thereto. Any use, reproduction, disclosure or
7  * distribution of this software and related documentation without an express
8  * license agreement from NVIDIA CORPORATION is strictly prohibited.
9  */
10 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12 
13 
14 #ifndef PX_JOINTCONSTRAINT_H
15 #define PX_JOINTCONSTRAINT_H
16 
20 #include "foundation/PxTransform.h"
21 #include "PxRigidActor.h"
22 #include "PxConstraint.h"
23 #include "common/PxBase.h"
24 
25 #ifndef PX_DOXYGEN
26 namespace physx
27 {
28 #endif
29 
30 class PxRigidActor;
31 class PxScene;
32 class PxPhysics;
33 class PxConstraint;
34 
41 {
42  enum Enum
43  {
49  eD6,
50  eLast
51  };
52 };
53 
61 
69 
77 {
78  enum Enum
79  {
82  COUNT
83  };
84 };
85 
90 class PxJoint : public PxBase
91 {
92 //= ATTENTION! =====================================================================================
93 // Changing the data layout of this class breaks the binary serialization format. See comments for
94 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
95 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
96 // accordingly.
97 //==================================================================================================
98 public:
99 
111  virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) = 0;
112 
122  virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const = 0;
123 
135  virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0;
136 
147  virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const = 0;
148 
149 
157  virtual PxTransform getRelativeTransform() const = 0;
158 
166  virtual PxVec3 getRelativeLinearVelocity() const = 0;
167 
174  virtual PxVec3 getRelativeAngularVelocity() const = 0;
175 
176 
189  virtual void setBreakForce(PxReal force, PxReal torque) = 0;
190 
199  virtual void getBreakForce(PxReal& force, PxReal& torque) const = 0;
200 
208  virtual void setConstraintFlags(PxConstraintFlags flags) = 0;
209 
218  virtual void setConstraintFlag(PxConstraintFlag::Enum flag, bool value) = 0;
219 
220 
228  virtual PxConstraintFlags getConstraintFlags() const = 0;
229 
230 
231 
239  virtual void setInvMassScale0(PxReal invMassScale) = 0;
240 
249  virtual PxReal getInvMassScale0() const = 0;
250 
259  virtual void setInvInertiaScale0(PxReal invInertiaScale) = 0;
260 
268  virtual PxReal getInvInertiaScale0() const = 0;
269 
270 
278  virtual void setInvMassScale1(PxReal invMassScale) = 0;
279 
288  virtual PxReal getInvMassScale1() const = 0;
289 
298  virtual void setInvInertiaScale1(PxReal invInertiaScale) = 0;
299 
307  virtual PxReal getInvInertiaScale1() const = 0;
308 
309 
318  virtual PxConstraint* getConstraint() const = 0;
319 
331  virtual void setName(const char* name) = 0;
332 
341  virtual const char* getName() const = 0;
342 
349  virtual void release() = 0;
350 
351 
352 
360  virtual PxScene* getScene() const = 0;
361 
362  void* userData;
363 
364  //serialization
365 
369  static void getBinaryMetaData(PxOutputStream& stream);
370 
371  //~serialization
372 
381  PX_DEPRECATED PxJointType::Enum getType() { return static_cast<PxJointType::Enum>(getConcreteType()); }
382 
383 
384 protected:
385  virtual ~PxJoint() {}
386 
387  //serialization
388 
392  PX_INLINE PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
393 
397  PX_INLINE PxJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
398 
402  virtual bool isKindOf(const char* name) const { return !strcmp("PxJoint", name) || PxBase::isKindOf(name); }
403 
404  //~serialization
405 };
406 
407 class PxSpring
408 {
409 //= ATTENTION! =====================================================================================
410 // Changing the data layout of this class breaks the binary serialization format. See comments for
411 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
412 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
413 // accordingly.
414 //==================================================================================================
415 public:
416 
419 
420  PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {}
421 };
422 
423 
424 #ifndef PX_DOXYGEN
425 } // namespace physx
426 #endif
427 
442 PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis);
443 
445 #endif


Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved. www.nvidia.com