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-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 
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  };
141 };
142 
149 PX_FLAGS_OPERATORS(PxRigidBodyFlag::Enum,PxU8)
150 
151 
157 class PxRigidBody : public PxRigidActor
158 {
159 public:
160  // Runtime modifications
161 
162 /************************************************************************************************/
180  virtual void setCMassLocalPose(const PxTransform& pose) = 0;
181 
182 
190  virtual PxTransform getCMassLocalPose() const = 0;
191 
192 
212  virtual void setMass(PxReal mass) = 0;
213 
223  virtual PxReal getMass() const = 0;
224 
232  virtual PxReal getInvMass() const = 0;
233 
255  virtual void setMassSpaceInertiaTensor(const PxVec3& m) = 0;
256 
268  virtual PxVec3 getMassSpaceInertiaTensor() const = 0;
269 
281  virtual PxVec3 getMassSpaceInvInertiaTensor() const = 0;
282 
283  /************************************************************************************************/
298  virtual void setLinearDamping(PxReal linDamp) = 0;
299 
307  virtual PxReal getLinearDamping() const = 0;
308 
322  virtual void setAngularDamping(PxReal angDamp) = 0;
323 
331  virtual PxReal getAngularDamping() const = 0;
332 
333 
334 /************************************************************************************************/
346  virtual PxVec3 getLinearVelocity() const = 0;
347 
367  virtual void setLinearVelocity(const PxVec3& linVel, bool autowake = true ) = 0;
368 
369 
370 
378  virtual PxVec3 getAngularVelocity() const = 0;
379 
380 
400  virtual void setAngularVelocity(const PxVec3& angVel, bool autowake = true ) = 0;
401 
420  virtual void setMaxAngularVelocity(PxReal maxAngVel) = 0;
421 
429  virtual PxReal getMaxAngularVelocity() const = 0;
430 
431 
447  virtual void setMaxLinearVelocity(PxReal maxLinVel) = 0;
448 
456  virtual PxReal getMaxLinearVelocity() const = 0;
457 
458 
459 /************************************************************************************************/
493  virtual void addForce(const PxVec3& force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0;
494 
523  virtual void addTorque(const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0;
524 
544  virtual void clearForce(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
545 
565  virtual void clearTorque(PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
566 
567 
579  virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
580 
596  virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) = 0;
597  virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) = 0;
598 
608  virtual PxRigidBodyFlags getRigidBodyFlags() const = 0;
609 
631  virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) = 0;
632 
642  virtual PxReal getMinCCDAdvanceCoefficient() const = 0;
643 
644 
650  virtual void setMaxDepenetrationVelocity(PxReal biasClamp) = 0;
651 
657  virtual PxReal getMaxDepenetrationVelocity() const = 0;
658 
659 
669  virtual void setMaxContactImpulse(PxReal maxImpulse) = 0;
670 
678  virtual PxReal getMaxContactImpulse() const = 0;
679 
685  virtual PxU32 getInternalIslandNodeIndex() const = 0;
686 
687 
688 protected:
689  PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags) : PxRigidActor(concreteType, baseFlags) {}
690  PX_INLINE PxRigidBody(PxBaseFlags baseFlags) : PxRigidActor(baseFlags) {}
691  virtual ~PxRigidBody() {}
692  virtual bool isKindOf(const char* name)const { return !::strcmp("PxRigidBody", name) || PxRigidActor::isKindOf(name); }
693 };
694 
695 
696 #if !PX_DOXYGEN
697 } // namespace physx
698 #endif
699 
701 #endif
Definition: GuContactBuffer.h:37
virtual ~PxRigidBody()
Definition: PxRigidBody.h:691
PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags)
Definition: PxRigidBody.h:689
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
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
PxFlags< PxRigidBodyFlag::Enum, PxU8 > PxRigidBodyFlags
collection of set bits defined in PxRigidBodyFlag.
Definition: PxRigidBody.h:148
uint8_t PxU8
Definition: PxSimpleTypes.h:75
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
PX_INLINE PxRigidBody(PxBaseFlags baseFlags)
Definition: PxRigidBody.h:690
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:157
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition: PxRigidBody.h:692
uint32_t PxU32
Definition: Px.h:48
#define PX_INLINE
Definition: PxPreprocessor.h:349
3 Element vector class.
Definition: PxVec3.h:49