PxJoint.h
Go to the documentation of this file.
1 //
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions
4 // are met:
5 // * Redistributions of source code must retain the above copyright
6 // notice, this list of conditions and the following disclaimer.
7 // * Redistributions in binary form must reproduce the above copyright
8 // notice, this list of conditions and the following disclaimer in the
9 // documentation and/or other materials provided with the distribution.
10 // * Neither the name of NVIDIA CORPORATION nor the names of its
11 // contributors may be used to endorse or promote products derived
12 // from this software without specific prior written permission.
13 //
14 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
15 // EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
18 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 // OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 //
26 // Copyright (c) 2008-2021 NVIDIA Corporation. All rights reserved.
27 // Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
28 // Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
29 
30 #ifndef PX_JOINTCONSTRAINT_H
31 #define PX_JOINTCONSTRAINT_H
32 
36 #include "foundation/PxTransform.h"
37 #include "PxRigidActor.h"
38 #include "PxConstraint.h"
39 #include "common/PxBase.h"
40 
41 #if !PX_DOXYGEN
42 namespace physx
43 {
44 #endif
45 
46 class PxRigidActor;
47 class PxScene;
48 class PxPhysics;
49 class PxConstraint;
50 
57 {
58  enum Enum
59  {
65  eD6,
67  eLast
68  };
69 };
70 
79 
80 
81 
88 {
89  enum Enum
90  {
93  COUNT
94  };
95 };
96 
101 class PxJoint : public PxBase
102 {
103 //= ATTENTION! =====================================================================================
104 // Changing the data layout of this class breaks the binary serialization format. See comments for
105 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
106 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
107 // accordingly.
108 //==================================================================================================
109 public:
110 
121  virtual void setActors(PxRigidActor* actor0, PxRigidActor* actor1) = 0;
122 
131  virtual void getActors(PxRigidActor*& actor0, PxRigidActor*& actor1) const = 0;
132 
143  virtual void setLocalPose(PxJointActorIndex::Enum actor, const PxTransform& localPose) = 0;
144 
154  virtual PxTransform getLocalPose(PxJointActorIndex::Enum actor) const = 0;
155 
162  virtual PxTransform getRelativeTransform() const = 0;
163 
170  virtual PxVec3 getRelativeLinearVelocity() const = 0;
171 
177  virtual PxVec3 getRelativeAngularVelocity() const = 0;
178 
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 
227  virtual PxConstraintFlags getConstraintFlags() const = 0;
228 
236  virtual void setInvMassScale0(PxReal invMassScale) = 0;
237 
245  virtual PxReal getInvMassScale0() const = 0;
246 
254  virtual void setInvInertiaScale0(PxReal invInertiaScale) = 0;
255 
263  virtual PxReal getInvInertiaScale0() const = 0;
264 
272  virtual void setInvMassScale1(PxReal invMassScale) = 0;
273 
281  virtual PxReal getInvMassScale1() const = 0;
282 
290  virtual void setInvInertiaScale1(PxReal invInertiaScale) = 0;
291 
299  virtual PxReal getInvInertiaScale1() const = 0;
300 
308  virtual PxConstraint* getConstraint() const = 0;
309 
320  virtual void setName(const char* name) = 0;
321 
329  virtual const char* getName() const = 0;
330 
336  virtual void release() = 0;
337 
345  virtual PxScene* getScene() const = 0;
346 
347  void* userData;
348 
349  //serialization
350 
354  static void getBinaryMetaData(PxOutputStream& stream);
355 
356  //~serialization
357 
358 protected:
359  virtual ~PxJoint() {}
360 
361  //serialization
362 
366  PX_INLINE PxJoint(PxType concreteType, PxBaseFlags baseFlags) : PxBase(concreteType, baseFlags), userData(NULL) {}
367 
371  PX_INLINE PxJoint(PxBaseFlags baseFlags) : PxBase(baseFlags) {}
372 
376  virtual bool isKindOf(const char* name) const { return !::strcmp("PxJoint", name) || PxBase::isKindOf(name); }
377 
378  //~serialization
379 };
380 
381 class PxSpring
382 {
383 //= ATTENTION! =====================================================================================
384 // Changing the data layout of this class breaks the binary serialization format. See comments for
385 // PX_BINARY_SERIAL_VERSION. If a modification is required, please adjust the getBinaryMetaData
386 // function. If the modification is made on a custom branch, please change PX_BINARY_SERIAL_VERSION
387 // accordingly.
388 //==================================================================================================
389 public:
390 
393 
394  PxSpring(PxReal stiffness_, PxReal damping_): stiffness(stiffness_), damping(damping_) {}
395 };
396 
397 
398 #if !PX_DOXYGEN
399 } // namespace physx
400 #endif
401 
416 PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint& joint, const physx::PxVec3* wsAnchor, const physx::PxVec3* wsAxis);
417 
419 #endif
Definition: GuContactBuffer.h:37
an enumeration for specifying one or other of the actors referenced by a joint
Definition: PxJoint.h:87
A scene is a collection of bodies and constraints which can interact.
Definition: PxScene.h:169
Definition: PxJoint.h:61
PxSpring(PxReal stiffness_, PxReal damping_)
Definition: PxJoint.h:394
A prismatic joint permits relative translational movement between two bodies along an axis...
Definition: PxPrismaticJoint.h:87
Definition: PxTypeInfo.h:79
Definition: PxJoint.h:91
float PxReal
Definition: PxSimpleTypes.h:78
Definition: PxJoint.h:65
#define PX_C_EXPORT
Definition: Pxc.h:54
virtual bool isKindOf(const char *superClass) const
Returns whether a given type name matches with the type of this instance.
Definition: PxBase.h:178
PxVec3 force
Definition: PxArticulationReducedCoordinate.h:132
#define PX_CALL_CONV
Definition: PxPreprocessor.h:315
Definition: PxJoint.h:63
PX_INLINE PxJoint(PxType concreteType, PxBaseFlags baseFlags)
Constructor.
Definition: PxJoint.h:366
void * userData
user can assign this to whatever, usually to create a 1:1 relationship with a user object...
Definition: PxJoint.h:347
PxU16 PxType
Definition: PxBase.h:49
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition: PxRigidActor.h:58
PxReal stiffness
spring parameter, for spring constraints
Definition: PxConstraintDesc.h:99
Output stream class for I/O.
Definition: PxIO.h:114
Enum
Definition: PxJoint.h:58
a joint that maintains an upper or lower bound (or both) on the distance between two points on differ...
Definition: PxContactJoint.h:95
a base interface providing common functionality for PhysX joints
Definition: PxJoint.h:101
Definition: PxJoint.h:66
Enum
Definition: PxJoint.h:89
A joint which behaves in a similar way to a hinge or axle.
Definition: PxRevoluteJoint.h:99
virtual ~PxJoint()
Definition: PxJoint.h:359
Definition: PxJoint.h:62
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxJoint.h:376
PxU16 flags
a set of Px1DConstraintFlags
Definition: PxConstraintDesc.h:110
Definition: PxJoint.h:64
Definition: PxJoint.h:381
PxReal stiffness
the spring strength of the drive: that is, the force proportional to the position error ...
Definition: PxJoint.h:391
PxReal damping
damping parameter, for spring constraints
Definition: PxConstraintDesc.h:100
class representing a rigid euclidean transform as a quaternion and a vector
Definition: PxTransform.h:48
A plugin class for implementing constraints.
Definition: PxConstraint.h:108
Enum
Definition: PxConstraint.h:64
A joint which behaves in a similar way to a ball and socket.
Definition: PxSphericalJoint.h:89
a joint that maintains an upper or lower bound (or both) on the distance between two points on differ...
Definition: PxDistanceJoint.h:82
#define PX_DEFINE_TYPEINFO(_name, _fastType)
Definition: PxTypeInfo.h:93
PxReal damping
the damping strength of the drive: that is, the force proportional to the velocity error ...
Definition: PxJoint.h:392
A fixed joint permits no relative movement between two bodies. ie the bodies are glued together...
Definition: PxFixedJoint.h:65
PX_C_EXPORT void PX_CALL_CONV PxSetJointGlobalFrame(physx::PxJoint &joint, const physx::PxVec3 *wsAnchor, const physx::PxVec3 *wsAxis)
Helper function to setup a joint's global frame.
an enumeration of PhysX' built-in joint types
Definition: PxJoint.h:56
PxVec3 torque
Definition: PxArticulationReducedCoordinate.h:134
Container for bitfield flag variables associated with a specific enum type.
Definition: PxFlags.h:73
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition: PxPhysics.h:71
Definition: PxJoint.h:60
Base class for objects that can be members of a PxCollection.
Definition: PxBase.h:73
Definition: PxTypeInfo.h:57
#define PX_INLINE
Definition: PxPreprocessor.h:336
PX_INLINE PxJoint(PxBaseFlags baseFlags)
Deserialization constructor.
Definition: PxJoint.h:371
Definition: PxJoint.h:92
3 Element vector class.
Definition: PxVec3.h:49
A D6 joint is a general constraint between two actors.
Definition: PxD6Joint.h:224