RavEngine
Loading...
Searching...
No Matches
PxDistanceJoint.h
1// Redistribution and use in source and binary forms, with or without
2// modification, are permitted provided that the following conditions
3// are met:
4// * Redistributions of source code must retain the above copyright
5// notice, this list of conditions and the following disclaimer.
6// * Redistributions in binary form must reproduce the above copyright
7// notice, this list of conditions and the following disclaimer in the
8// documentation and/or other materials provided with the distribution.
9// * Neither the name of NVIDIA CORPORATION nor the names of its
10// contributors may be used to endorse or promote products derived
11// from this software without specific prior written permission.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
14// EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16// PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
17// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18// EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19// PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20// PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21// OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24//
25// Copyright (c) 2008-2022 NVIDIA Corporation. All rights reserved.
26// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
27// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
28
29#ifndef PX_DISTANCE_JOINT_H
30#define PX_DISTANCE_JOINT_H
35#include "extensions/PxJoint.h"
36
37#if !PX_DOXYGEN
38namespace physx
39{
40#endif
41
42class PxDistanceJoint;
43
55PxDistanceJoint* PxDistanceJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1);
56
57
64{
65 enum Enum
66 {
67 eMAX_DISTANCE_ENABLED = 1<<1,
68 eMIN_DISTANCE_ENABLED = 1<<2,
69 eSPRING_ENABLED = 1<<3
70 };
71};
72
74PX_FLAGS_OPERATORS(PxDistanceJointFlag::Enum, PxU16)
75
76
82{
83public:
84
88 virtual PxReal getDistance() const = 0;
89
102 virtual void setMinDistance(PxReal distance) = 0;
103
111 virtual PxReal getMinDistance() const = 0;
112
125 virtual void setMaxDistance(PxReal distance) = 0;
126
134 virtual PxReal getMaxDistance() const = 0;
135
143 virtual void setTolerance(PxReal tolerance) = 0;
144
158 virtual PxReal getTolerance() const = 0;
159
172 virtual void setStiffness(PxReal stiffness) = 0;
173
181 virtual PxReal getStiffness() const = 0;
182
195 virtual void setDamping(PxReal damping) = 0;
196
204 virtual PxReal getDamping() const = 0;
205
223 virtual void setContactDistance(PxReal contactDistance) = 0;
224
232 virtual PxReal getContactDistance() const = 0;
233
244
253 virtual void setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value) = 0;
254
263
267 virtual const char* getConcreteTypeName() const { return "PxDistanceJoint"; }
268
269protected:
270
271 //serialization
272
276 PX_INLINE PxDistanceJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
277
281 PX_INLINE PxDistanceJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
282
286 virtual bool isKindOf(const char* name) const { return !::strcmp("PxDistanceJoint", name) || PxJoint::isKindOf(name); }
287
288 //~serialization
289};
290
291#if !PX_DOXYGEN
292} // namespace physx
293#endif
294
296#endif
a joint that maintains an upper or lower bound (or both) on the distance between two points on differ...
Definition PxDistanceJoint.h:82
virtual void setStiffness(PxReal stiffness)=0
Set the strength of the joint spring.
virtual PxDistanceJointFlags getDistanceJointFlags() const =0
Get the flags specific to the Distance Joint.
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxDistanceJoint.h:286
virtual PxReal getMinDistance() const =0
Get the allowed minimum distance for the joint.
virtual void setContactDistance(PxReal contactDistance)=0
Set the contact distance for the min & max distance limits.
virtual void setDistanceJointFlags(PxDistanceJointFlags flags)=0
Set the flags specific to the Distance Joint.
virtual void setTolerance(PxReal tolerance)=0
Set the error tolerance of the joint.
virtual PxReal getDamping() const =0
Get the damping of the joint spring.
virtual void setDistanceJointFlag(PxDistanceJointFlag::Enum flag, bool value)=0
Set a single flag specific to a Distance Joint to true or false.
virtual PxReal getStiffness() const =0
Get the strength of the joint spring.
virtual const char * getConcreteTypeName() const
Returns string name of PxDistanceJoint, used for serialization.
Definition PxDistanceJoint.h:267
virtual PxReal getContactDistance() const =0
Get the contact distance.
virtual PxReal getMaxDistance() const =0
Get the allowed maximum distance for the joint.
virtual void setMaxDistance(PxReal distance)=0
Set the allowed maximum distance for the joint.
virtual PxReal getTolerance() const =0
Get the error tolerance of the joint.
PX_INLINE PxDistanceJoint(PxType concreteType, PxBaseFlags baseFlags)
Constructor.
Definition PxDistanceJoint.h:276
PX_INLINE PxDistanceJoint(PxBaseFlags baseFlags)
Deserialization constructor.
Definition PxDistanceJoint.h:281
virtual void setMinDistance(PxReal distance)=0
Set the allowed minimum distance for the joint.
virtual void setDamping(PxReal damping)=0
Set the damping of the joint spring.
virtual PxReal getDistance() const =0
Return the current distance of the joint.
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
a base interface providing common functionality for PhysX joints
Definition PxJoint.h:105
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxJoint.h:379
#define PX_INLINE
Definition PxPreprocessor.h:320
Sorts an array of objects in ascending order, assuming that the predicate implements the < operator:
Definition PxBoxController.h:39
PxDistanceJoint * PxDistanceJointCreate(PxPhysics &physics, PxRigidActor *actor0, const PxTransform &localFrame0, PxRigidActor *actor1, const PxTransform &localFrame1)
Create a distance Joint.
Definition ExtDistanceJoint.cpp:319
flags for configuring the drive of a PxDistanceJoint
Definition PxDistanceJoint.h:64