PxDistanceJoint.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-2018 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_DISTANCEJOINT_H
31 #define PX_DISTANCEJOINT_H
32 
36 #include "extensions/PxJoint.h"
37 
38 #if !PX_DOXYGEN
39 namespace physx
40 {
41 #endif
42 
43 class PxDistanceJoint;
44 
56 PxDistanceJoint* PxDistanceJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1);
57 
58 
65 {
66  enum Enum
67  {
68  eMAX_DISTANCE_ENABLED = 1<<1,
69  eMIN_DISTANCE_ENABLED = 1<<2,
70  eSPRING_ENABLED = 1<<3
71  };
72 };
73 
75 PX_FLAGS_OPERATORS(PxDistanceJointFlag::Enum, PxU16)
76 
77 
82 class PxDistanceJoint : public PxJoint
83 {
84 public:
85 
89  virtual PxReal getDistance() const = 0;
90 
103  virtual void setMinDistance(PxReal distance) = 0;
104 
112  virtual PxReal getMinDistance() const = 0;
113 
126  virtual void setMaxDistance(PxReal distance) = 0;
127 
135  virtual PxReal getMaxDistance() const = 0;
136 
144  virtual void setTolerance(PxReal tolerance) = 0;
145 
159  virtual PxReal getTolerance() const = 0;
160 
173  virtual void setStiffness(PxReal stiffness) = 0;
174 
182  virtual PxReal getStiffness() const = 0;
183 
196  virtual void setDamping(PxReal damping) = 0;
197 
205  virtual PxReal getDamping() const = 0;
206 
216  virtual void setDistanceJointFlags(PxDistanceJointFlags flags) = 0;
217 
226  virtual void setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value) = 0;
227 
235  virtual PxDistanceJointFlags getDistanceJointFlags() const = 0;
236 
240  virtual const char* getConcreteTypeName() const { return "PxDistanceJoint"; }
241 
242 protected:
243 
244  //serialization
245 
249  PX_INLINE PxDistanceJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
250 
254  PX_INLINE PxDistanceJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
255 
259  virtual bool isKindOf(const char* name) const { return !::strcmp("PxDistanceJoint", name) || PxJoint::isKindOf(name); }
260 
261  //~serialization
262 };
263 
264 #if !PX_DOXYGEN
265 } // namespace physx
266 #endif
267 
269 #endif
Definition: GuContactBuffer.h:37
float PxReal
Definition: PxSimpleTypes.h:78
Enum
Definition: PxDistanceJoint.h:66
PxDistanceJoint * PxDistanceJointCreate(PxPhysics &physics, PxRigidActor *actor0, const PxTransform &localFrame0, PxRigidActor *actor1, const PxTransform &localFrame1)
Create a distance Joint.
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
a base interface providing common functionality for PhysX joints
Definition: PxJoint.h:101
PX_INLINE PxDistanceJoint(PxType concreteType, PxBaseFlags baseFlags)
Constructor.
Definition: PxDistanceJoint.h:249
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
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 joint that maintains an upper or lower bound (or both) on the distance between two points on differ...
Definition: PxDistanceJoint.h:82
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxDistanceJoint.h:259
flags for configuring the drive of a PxDistanceJoint
Definition: PxDistanceJoint.h:64
virtual const char * getConcreteTypeName() const
Returns string name of PxDistanceJoint, used for serialization.
Definition: PxDistanceJoint.h:240
PX_INLINE PxDistanceJoint(PxBaseFlags baseFlags)
Deserialization constructor.
Definition: PxDistanceJoint.h:254
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
uint16_t PxU16
Definition: PxSimpleTypes.h:73
PxFlags< PxDistanceJointFlag::Enum, PxU16 > PxDistanceJointFlags
Definition: PxDistanceJoint.h:74
#define PX_INLINE
Definition: PxPreprocessor.h:349