RavEngine
Loading...
Searching...
No Matches
PxRigidBody.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_RIGID_BODY_H
30#define PX_RIGID_BODY_H
35#include "PxRigidActor.h"
36#include "PxForceMode.h"
37#include "PxNodeIndex.h"
38
39#if !PX_DOXYGEN
40namespace physx
41{
42#endif
43
183
190PX_FLAGS_OPERATORS(PxRigidBodyFlag::Enum,PxU16)
191
192
199{
200public:
201 // Runtime modifications
202
203/************************************************************************************************/
221 virtual void setCMassLocalPose(const PxTransform& pose) = 0;
222
230 virtual PxTransform getCMassLocalPose() const = 0;
231
251 virtual void setMass(PxReal mass) = 0;
252
262 virtual PxReal getMass() const = 0;
263
271 virtual PxReal getInvMass() const = 0;
272
294 virtual void setMassSpaceInertiaTensor(const PxVec3& m) = 0;
295
308
321
322 /************************************************************************************************/
337 virtual void setLinearDamping(PxReal linDamp) = 0;
338
346 virtual PxReal getLinearDamping() const = 0;
347
361 virtual void setAngularDamping(PxReal angDamp) = 0;
362
370 virtual PxReal getAngularDamping() const = 0;
371
372
373/************************************************************************************************/
387 virtual PxVec3 getLinearVelocity() const = 0;
388
399 virtual PxVec3 getAngularVelocity() const = 0;
400
416 virtual void setMaxLinearVelocity(PxReal maxLinVel) = 0;
417
425 virtual PxReal getMaxLinearVelocity() const = 0;
426
445 virtual void setMaxAngularVelocity(PxReal maxAngVel) = 0;
446
454 virtual PxReal getMaxAngularVelocity() const = 0;
455
456/************************************************************************************************/
490 virtual void addForce(const PxVec3& force, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0;
491
520 virtual void addTorque(const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE, bool autowake = true) = 0;
521
542
563
575 virtual void setForceAndTorque(const PxVec3& force, const PxVec3& torque, PxForceMode::Enum mode = PxForceMode::eFORCE) = 0;
576
591 virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value) = 0;
592 virtual void setRigidBodyFlags(PxRigidBodyFlags inFlags) = 0;
593
604
625 virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient) = 0;
626
634 virtual PxReal getMinCCDAdvanceCoefficient() const = 0;
635
641 virtual void setMaxDepenetrationVelocity(PxReal biasClamp) = 0;
642
648 virtual PxReal getMaxDepenetrationVelocity() const = 0;
649
659 virtual void setMaxContactImpulse(PxReal maxImpulse) = 0;
660
668 virtual PxReal getMaxContactImpulse() const = 0;
669
680 virtual void setContactSlopCoefficient(PxReal slopCoefficient) = 0;
681
689 virtual PxReal getContactSlopCoefficient() const = 0;
690
697
698protected:
699 PX_INLINE PxRigidBody(PxType concreteType, PxBaseFlags baseFlags) : PxRigidActor(concreteType, baseFlags) {}
700 PX_INLINE PxRigidBody(PxBaseFlags baseFlags) : PxRigidActor(baseFlags) {}
701 virtual ~PxRigidBody() {}
702 virtual bool isKindOf(const char* name) const { return !::strcmp("PxRigidBody", name) || PxRigidActor::isKindOf(name); }
703};
704
705#if !PX_DOXYGEN
706} // namespace physx
707#endif
708
710#endif
Container for bitfield flag variables associated with a specific enum type.
Definition PxFlags.h:73
PxNodeIndex.
Definition PxNodeIndex.h:51
PxRigidActor represents a base class shared between dynamic and static rigid bodies in the physics SD...
Definition PxRigidActor.h:53
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxRigidActor.h:227
PxRigidBody is a base class shared between dynamic rigid body objects.
Definition PxRigidBody.h:199
virtual PxVec3 getAngularVelocity() const =0
Retrieves the angular velocity of the actor.
virtual void setMassSpaceInertiaTensor(const PxVec3 &m)=0
Sets the inertia tensor, using a parameter specified in mass space coordinates.
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxRigidBody.h:702
virtual void setContactSlopCoefficient(PxReal slopCoefficient)=0
Sets a distance scale whereby the angular influence of a contact on the normal constraint in a contac...
virtual PxTransform getCMassLocalPose() const =0
Retrieves the center of mass pose relative to the actor frame.
virtual void setMaxAngularVelocity(PxReal maxAngVel)=0
Lets you set the maximum angular velocity permitted for this actor.
virtual void setMaxDepenetrationVelocity(PxReal biasClamp)=0
Sets the maximum depenetration velocity permitted to be introduced by the solver. This value controls...
virtual void setMaxContactImpulse(PxReal maxImpulse)=0
Sets a limit on the impulse that may be applied at a contact. The maximum impulse at a contact betwee...
virtual void addTorque(const PxVec3 &torque, PxForceMode::Enum mode=PxForceMode::eFORCE, bool autowake=true)=0
Applies an impulsive torque defined in the global coordinate frame to the actor.
virtual PxReal getContactSlopCoefficient() const =0
Returns the contact slop coefficient.
virtual PxReal getLinearDamping() const =0
Retrieves the linear damping coefficient.
virtual PxNodeIndex getInternalIslandNodeIndex() const =0
Returns the island node index.
virtual PxRigidBodyFlags getRigidBodyFlags() const =0
Reads the PxRigidBody flags.
virtual void setLinearDamping(PxReal linDamp)=0
Sets the linear damping coefficient.
virtual PxVec3 getMassSpaceInvInertiaTensor() const =0
Retrieves the diagonal inverse inertia tensor of the actor relative to the mass coordinate frame.
virtual void clearTorque(PxForceMode::Enum mode=PxForceMode::eFORCE)=0
Clears the impulsive torque defined in the global coordinate frame to the actor.
virtual PxReal getMaxDepenetrationVelocity() const =0
Returns the maximum depenetration velocity the solver is permitted to introduced. This value controls...
virtual void setForceAndTorque(const PxVec3 &force, const PxVec3 &torque, PxForceMode::Enum mode=PxForceMode::eFORCE)=0
Sets the impulsive force and torque defined in the global coordinate frame to the actor.
virtual void setCMassLocalPose(const PxTransform &pose)=0
Sets the pose of the center of mass relative to the actor.
virtual PxVec3 getMassSpaceInertiaTensor() const =0
Retrieves the diagonal inertia tensor of the actor relative to the mass coordinate frame.
virtual void setAngularDamping(PxReal angDamp)=0
Sets the angular damping coefficient.
virtual PxReal getMinCCDAdvanceCoefficient() const =0
Gets the CCD minimum advance coefficient.
virtual void setRigidBodyFlag(PxRigidBodyFlag::Enum flag, bool value)=0
Raises or clears a particular rigid body flag.
virtual PxReal getMass() const =0
Retrieves the mass of the actor.
virtual PxReal getMaxLinearVelocity() const =0
Retrieves the maximum angular velocity permitted for this actor.
virtual void addForce(const PxVec3 &force, PxForceMode::Enum mode=PxForceMode::eFORCE, bool autowake=true)=0
Applies a force (or impulse) defined in the global coordinate frame to the actor at its center of mas...
virtual void setMass(PxReal mass)=0
Sets the mass of a dynamic actor.
virtual void clearForce(PxForceMode::Enum mode=PxForceMode::eFORCE)=0
Clears the accumulated forces (sets the accumulated force back to zero).
virtual PxReal getAngularDamping() const =0
Retrieves the angular damping coefficient.
virtual PxVec3 getLinearVelocity() const =0
Retrieves the linear velocity of an actor.
virtual PxReal getInvMass() const =0
Retrieves the inverse mass of the actor.
virtual void setMinCCDAdvanceCoefficient(PxReal advanceCoefficient)=0
Sets the CCD minimum advance coefficient.
virtual PxReal getMaxAngularVelocity() const =0
Retrieves the maximum angular velocity permitted for this actor.
virtual PxReal getMaxContactImpulse() const =0
Returns the maximum impulse that may be applied at a contact.
virtual void setMaxLinearVelocity(PxReal maxLinVel)=0
Lets you set the maximum linear velocity permitted for this actor.
class representing a rigid euclidean transform as a quaternion and a vector
Definition PxTransform.h:49
3 Element vector class.
Definition PxVec3.h:50
#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
PxFlags< PxRigidBodyFlag::Enum, PxU16 > PxRigidBodyFlags
collection of set bits defined in PxRigidBodyFlag.
Definition PxRigidBody.h:189
Enum
Definition PxForceMode.h:51
@ eFORCE
parameter has unit of mass * length / time^2, i.e., a force
Definition PxForceMode.h:52
Collection of flags describing the behavior of a rigid body.
Definition PxRigidBody.h:50
Enum
Definition PxRigidBody.h:52
@ eFORCE_KINE_KINE_NOTIFICATIONS
Forces kinematic-kinematic pairs notifications for this actor.
Definition PxRigidBody.h:157
@ eFORCE_STATIC_KINE_NOTIFICATIONS
Forces static-kinematic pairs notifications for this actor.
Definition PxRigidBody.h:170
@ eENABLE_SPECULATIVE_CCD
Register a rigid body to dynamically adjust contact offset based on velocity. This can be used to ach...
Definition PxRigidBody.h:115
@ eUSE_KINEMATIC_TARGET_FOR_SCENE_QUERIES
Use the kinematic target transform for scene queries.
Definition PxRigidBody.h:85
@ eENABLE_CCD_FRICTION
Enabled CCD in swept integration for the actor.
Definition PxRigidBody.h:107
@ eRETAIN_ACCELERATIONS
Carries over forces/accelerations between frames, rather than clearing them.
Definition PxRigidBody.h:137
@ eENABLE_CCD_MAX_CONTACT_IMPULSE
Permit CCD to limit maxContactImpulse. This is useful for use-cases like a destruction system but can...
Definition PxRigidBody.h:132
@ eENABLE_POSE_INTEGRATION_PREVIEW
Register a rigid body for reporting pose changes by the simulation at an early stage.
Definition PxRigidBody.h:127
@ eKINEMATIC
Enables kinematic mode for the actor.
Definition PxRigidBody.h:74
@ eENABLE_CCD
Enables swept integration for the actor.
Definition PxRigidBody.h:96
@ eRESERVED
Reserved for internal usage.
Definition PxRigidBody.h:180
@ eENABLE_GYROSCOPIC_FORCES
Enables computation of gyroscopic forces on the rigid body.
Definition PxRigidBody.h:175