PxRigidBody.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 
31 #ifndef PX_PHYSICS_NX_RIGIDBODY
32 #define PX_PHYSICS_NX_RIGIDBODY
33 
37 #include "PxRigidActor.h"
38 #include "PxForceMode.h"
39 
40 #if !PX_DOXYGEN
41 namespace physx
42 {
43 #endif
44 
45 
53 {
54  enum Enum
55  {
56 
78  eKINEMATIC = (1<<0),
79 
89  eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES = (1<<1),
90 
101  eENABLE_CCD = (1<<2),
102 
112  eENABLE_CCD_FRICTION = (1<<3),
113 
124  eENABLE_POSE_INTEGRATION_PREVIEW = (1 << 4),
125 
129  eENABLE_SPECULATIVE_CCD = (1 << 5),
130 
134  eENABLE_CCD_MAX_CONTACT_IMPULSE = (1 << 6),
135 
139  eRETAIN_ACCELERATIONS = (1<<7),
140 
159  eFORCE_KINE_KINE_NOTIFICATIONS = (1<<8),
160 
172  eFORCE_STATIC_KINE_NOTIFICATIONS = (1<<9),
173 
177  eRESERVED = (1<<15)
178  };
179 };
180 
187 PX_FLAGS_OPERATORS(PxRigidBodyFlag::Enum,PxU16)
188 
189 
195 class PxRigidBody : public PxRigidActor
196 {
197 public:
198  // Runtime modifications
199 
200 /************************************************************************************************/
218  virtual void setCMassLocalPose(const PxTransform& pose) = 0;
219 
220 
228  virtual PxTransform getCMassLocalPose() const = 0;
229 
230 
250  virtual void setMass(PxReal mass) = 0;
251 
261  virtual PxReal getMass() const = 0;
262 
270  virtual PxReal getInvMass() const = 0;
271 
293  virtual void setMassSpaceInertiaTensor(const PxVec3& m) = 0;
294 
306  virtual PxVec3 getMassSpaceInertiaTensor() const = 0;
307 
319  virtual PxVec3 getMassSpaceInvInertiaTensor() const = 0;
320 
321  /************************************************************************************************/
336  virtual void setLinearDamping(PxReal linDamp) = 0;
337 
345  virtual PxReal getLinearDamping() const = 0;
346 
360  virtual void setAngularDamping(PxReal angDamp) = 0;
361 
369  virtual PxReal getAngularDamping() const = 0;
370 
371 
372 /************************************************************************************************/
384  virtual PxVec3 getLinearVelocity() const = 0;
385 
405  virtual void setLinearVelocity(const PxVec3& linVel, bool autowake = true ) = 0;
406 
407 
408 
416  virtual PxVec3 getAngularVelocity() const = 0;
417 
418 
438  virtual void setAngularVelocity(const PxVec3& angVel, bool autowake = true ) = 0;
439 
458  virtual void setMaxAngularVelocity(PxReal maxAngVel) = 0;
459 
467  virtual PxReal getMaxAngularVelocity() const = 0;
468 
469 
485  virtual void setMaxLinearVelocity(PxReal maxLinVel) = 0;
486 
494  virtual PxReal getMaxLinearVelocity() const = 0;
495 
496 
497 /************************************************************************************************/
531  virtual void addForce(const PxVec3& force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0;
532 
561  virtual void addTorque(const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0;
562 
582  virtual void clearForce(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
583 
603  virtual void clearTorque(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
604 
605 
617  virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
618 
634  virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) = 0;
635  virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) = 0;
636 
646  virtual PxRigidBodyFlags getRigidBodyFlags() const = 0;
647 
669  virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) = 0;
670 
680  virtual PxReal getMinCCDAdvanceCoefficient() const = 0;
681 
682 
688  virtual void setMaxDepenetrationVelocity(PxReal biasClamp) = 0;
689 
695  virtual PxReal getMaxDepenetrationVelocity() const = 0;
696 
697 
707  virtual void setMaxContactImpulse(PxReal maxImpulse) = 0;
708 
716  virtual PxReal getMaxContactImpulse() const = 0;
717 
723  virtual PxU32 getInternalIslandNodeIndex() const = 0;
724 
725 
726 protected:
727  PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags) : PxRigidActor(concreteType, baseFlags) {}
728  PX_INLINE PxRigidBody(PxBaseFlags baseFlags) : PxRigidActor(baseFlags) {}
729  virtual ~PxRigidBody() {}
730  virtual bool isKindOf(const char* name)const { return !::strcmp("PxRigidBody", name) || PxRigidActor::isKindOf(name); }
731 };
732 
733 
734 #if !PX_DOXYGEN
735 } // namespace physx
736 #endif
737 
739 #endif
Definition: GuContactBuffer.h:37
virtual ~PxRigidBody()
Definition: PxRigidBody.h:729
PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxRigidBody.h:727
PxReal maxImpulse
maximum impulse the solver may apply to enforce this constraint
Definition: PxConstraintDesc.h:93
Collection of flags describing the behavior of a rigid body.
Definition: PxRigidBody.h:52
Enum
Definition: PxRigidBody.h:54
float PxReal
Definition: PxSimpleTypes.h:78
PxVec3 force
Definition: PxArticulationReducedCoordinate.h:132
Enum
Definition: PxForceMode.h:52
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
parameter has unit of mass * distance/ time^2, i.e. a force
Definition: PxForceMode.h:54
class representing a rigid euclidean transform as a quaternion and a vector
Definition: PxTransform.h:48
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxRigidActor.h:228
PxFlags< PxRigidBodyFlag::Enum, PxU16 > PxRigidBodyFlags
collection of set bits defined in PxRigidBodyFlag.
Definition: PxRigidBody.h:186
PxVec3 torque
Definition: PxArticulationReducedCoordinate.h:134
PX_INLINE PxRigidBody(PxBaseFlags baseFlags)
Definition: PxRigidBody.h:728
Container for bitfield flag variables associated with a specific enum type.
Definition: PxFlags.h:73
PxRigidBody is a base class shared between dynamic rigid body objects.
Definition: PxRigidBody.h:195
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxRigidBody.h:730
uint16_t PxU16
Definition: PxSimpleTypes.h:73
uint32_t PxU32
Definition: Px.h:48
#define PX_INLINE
Definition: PxPreprocessor.h:336
3 Element vector class.
Definition: PxVec3.h:49