PxD6Joint.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_D6JOINT_H
15 #define PX_D6JOINT_H
16 
20 #include "extensions/PxJoint.h"
22 #include "foundation/PxFlags.h"
23 
24 #ifndef PX_DOXYGEN
25 namespace physx
26 {
27 #endif
28 
29 class PxD6Joint;
30 
44  PxRigidActor* actor0, const PxTransform& localFrame0,
45  PxRigidActor* actor1, const PxTransform& localFrame1);
46 
47 
48 
49 
56 struct PxD6Axis
57 {
58  enum Enum
59  {
60  eX = 0,
61  eY = 1,
62  eZ = 2,
63  eTWIST = 3,
64  eSWING1 = 4,
65  eSWING2 = 5,
66  eCOUNT = 6
67  };
68 };
69 
70 
76 struct PxD6Motion
77 {
78  enum Enum
79  {
82  eFREE
83  };
84 };
85 
86 
103 struct PxD6Drive
104 {
105  enum Enum
106  {
107  eX = 0,
108  eY = 1,
109  eZ = 2,
110  eSWING = 3,
111  eTWIST = 4,
112  eSLERP = 5,
113  eCOUNT = 6
114  };
115 };
116 
124 {
125  enum Enum
126  {
127  eACCELERATION = 1
128  };
129 };
132 
133 
134 
140 class PxD6JointDrive : public PxSpring
141 {
142 //= ATTENTION! =====================================================================================
143 // Changing the data layout of this class breaks the binary serialization format. See comments for
144 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
145 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
146 // accordingly.
147 //==================================================================================================
148 
149 public:
152 
153 
158  PxD6JointDrive(): PxSpring(0,0), forceLimit(PX_MAX_F32), flags(0) {}
159 
170  PxD6JointDrive(PxReal driveStiffness, PxReal driveDamping, PxReal driveForceLimit, bool isAcceleration = false)
171  : PxSpring(driveStiffness, driveDamping)
172  , forceLimit(driveForceLimit)
173  , flags(isAcceleration?(PxU32)PxD6JointDriveFlag::eACCELERATION : 0)
174  {}
175 
180  bool isValid() const
181  {
182  return PxIsFinite(stiffness) && stiffness>=0 &&
183  PxIsFinite(damping) && damping >=0 &&
184  PxIsFinite(forceLimit) && forceLimit >=0;
185  }
186 };
187 
188 
221 class PxD6Joint : public PxJoint
222 {
223 public:
224 
239  virtual void setMotion(PxD6Axis::Enum axis, PxD6Motion::Enum type) = 0;
240 
251  virtual PxD6Motion::Enum getMotion(PxD6Axis::Enum axis) const = 0;
252 
257  virtual PxReal getTwist() const = 0;
258 
263  virtual PxReal getSwingYAngle() const = 0;
264 
269  virtual PxReal getSwingZAngle() const = 0;
270 
271 
282  virtual void setLinearLimit(const PxJointLinearLimit& limit) = 0;
283 
292  virtual PxJointLinearLimit getLinearLimit() const = 0;
293 
294 
306  virtual void setTwistLimit(const PxJointAngularLimitPair& limit) = 0;
307 
308 
316  virtual PxJointAngularLimitPair getTwistLimit() const = 0;
317 
329  virtual void setSwingLimit(const PxJointLimitCone& limit) = 0;
330 
338  virtual PxJointLimitCone getSwingLimit() const = 0;
339 
351  virtual void setDrive(PxD6Drive::Enum index, const PxD6JointDrive& drive) = 0;
352 
360  virtual PxD6JointDrive getDrive(PxD6Drive::Enum index) const = 0;
361 
373  virtual void setDrivePosition(const PxTransform& pose) = 0;
374 
381  virtual PxTransform getDrivePosition() const = 0;
382 
383 
395  virtual void setDriveVelocity(const PxVec3& linear,
396  const PxVec3& angular) = 0;
397 
407  virtual void getDriveVelocity(PxVec3& linear,
408  PxVec3& angular) const = 0;
409 
410 
430  virtual void setProjectionLinearTolerance(PxReal tolerance) = 0;
431 
432 
441  virtual PxReal getProjectionLinearTolerance() const = 0;
442 
465  virtual void setProjectionAngularTolerance(PxReal tolerance) = 0;
466 
475  virtual PxReal getProjectionAngularTolerance() const = 0;
476 
480  virtual const char* getConcreteTypeName() const { return "PxD6Joint"; }
481 
482 
483 protected:
484 
485  //serialization
486 
490  PX_INLINE PxD6Joint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
491 
495  PX_INLINE PxD6Joint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
496 
500  virtual bool isKindOf(const char* name) const { return !strcmp("PxD6Joint", name) || PxJoint::isKindOf(name); }
501 
502  //~serialization
503 };
504 
505 #ifndef PX_DOXYGEN
506 } // namespace physx
507 #endif
508 
510 #endif


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