PxContactJoint.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_CONTACTJOINT_H
31 #define PX_CONTACTJOINT_H
32 
33 #include "extensions/PxJoint.h"
34 
35 #if !PX_DOXYGEN
36 namespace physx
37 {
38 #endif
39 
40  class PxContactJoint;
41 
53  PxContactJoint* PxContactJointCreate(PxPhysics& physics, PxRigidActor* actor0, const PxTransform& localFrame0, PxRigidActor* actor1, const PxTransform& localFrame1);
54 
62  {
67 
69 
70  PxJacobianRow(const PxVec3& lin0, const PxVec3& lin1, const PxVec3& ang0, const PxVec3& ang1) :
71  linear0(lin0), linear1(lin1), angular0(ang0), angular1(ang1)
72  {
73 
74  }
75 
76  void operator *= (const PxReal scale)
77  {
78  linear0 *= scale;
79  linear1 *= scale;
80  angular0 *= scale;
81  angular1 *= scale;
82  }
83 
84  PxJacobianRow operator * (const PxReal scale) const
85  {
86  return PxJacobianRow(linear0*scale, linear1*scale, angular0*scale, angular1*scale);
87  }
88  };
89 
95  class PxContactJoint : public PxJoint
96  {
97  public:
98 
102  virtual void setContact(const PxVec3& contact) = 0;
103 
107  virtual void setContactNormal(const PxVec3& contactNormal) = 0;
108 
112  virtual void setPenetration(const PxReal penetration) = 0;
113 
117  virtual PxVec3 getContact() const = 0;
118 
122  virtual PxVec3 getContactNormal() const = 0;
123 
127  virtual PxReal getPenetration() const = 0;
128 
129  virtual PxReal getResititution() const = 0;
130  virtual void setResititution(const PxReal resititution) = 0;
131  virtual PxReal getBounceThreshold() const = 0;
132  virtual void setBounceThreshold(const PxReal bounceThreshold) = 0;
133 
137  virtual const char* getConcreteTypeName() const { return "PxContactJoint"; }
138 
139  virtual void computeJacobians(PxJacobianRow* jacobian) const = 0;
140  virtual PxU32 getNbJacobianRows() const = 0;
141 
142  protected:
143  //serialization
144 
148  PX_INLINE PxContactJoint(PxType concreteType, PxBaseFlags baseFlags) : PxJoint(concreteType, baseFlags) {}
149 
153  PX_INLINE PxContactJoint(PxBaseFlags baseFlags) : PxJoint(baseFlags) {}
154 
158  virtual bool isKindOf(const char* name) const { return !::strcmp("PxContactJoint", name) || PxJoint::isKindOf(name); }
159 
160  //~serialization
161  };
162 
163 #if !PX_DOXYGEN
164 }
165 #endif
166 
167 
168 #endif
Definition: GuContactBuffer.h:37
PxVec3 linear0
linear component of velocity jacobian in world space
Definition: PxConstraintDesc.h:85
PxVec3 angular0
angular component of velocity jacobian in world space
Definition: PxConstraintDesc.h:87
float PxReal
Definition: PxSimpleTypes.h:78
PxVec3 linear0
Definition: PxContactJoint.h:63
PxVec3 angular1
Definition: PxContactJoint.h:66
a joint that maintains an upper or lower bound (or both) on the distance between two points on differ...
Definition: PxContactJoint.h:61
PxVec3 linear1
linear component of velocity jacobian in world space
Definition: PxConstraintDesc.h:90
PxVec3 angular1
angular component of velocity jacobian in world space
Definition: PxConstraintDesc.h:92
PxU16 PxType
Definition: PxBase.h:49
static PX_CUDA_CALLABLE PX_FORCE_INLINE PxVec2 operator*(float f, const PxVec2 &v)
Definition: PxVec2.h:337
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition: PxRigidActor.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
virtual const char * getConcreteTypeName() const
Returns string name of PxContactJoint, used for serialization.
Definition: PxContactJoint.h:137
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxJoint.h:376
PX_INLINE PxContactJoint(PxBaseFlags baseFlags)
Deserialization constructor.
Definition: PxContactJoint.h:153
PxJacobianRow(const PxVec3 &lin0, const PxVec3 &lin1, const PxVec3 &ang0, const PxVec3 &ang1)
Definition: PxContactJoint.h:70
class representing a rigid euclidean transform as a quaternion and a vector
Definition: PxTransform.h:48
PxVec3 linear1
Definition: PxContactJoint.h:64
PxJacobianRow()
Definition: PxContactJoint.h:68
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxContactJoint.h:158
PxVec3 contact
Contact point in world space.
Definition: PxContact.h:439
PxContactJoint * PxContactJointCreate(PxPhysics &physics, PxRigidActor *actor0, const PxTransform &localFrame0, PxRigidActor *actor1, const PxTransform &localFrame1)
Create a distance Joint.
PX_INLINE PxContactJoint(PxType concreteType, PxBaseFlags baseFlags)
Constructor.
Definition: PxContactJoint.h:148
PxVec3 angular0
Definition: PxContactJoint.h:65
Abstract singleton factory class used for instancing objects in the Physics SDK.
Definition: PxPhysics.h:71
uint32_t PxU32
Definition: Px.h:48
#define PX_INLINE
Definition: PxPreprocessor.h:336
3 Element vector class.
Definition: PxVec3.h:49