RavEngine
Loading...
Searching...
No Matches
PxRigidDynamic.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_DYNAMIC_H
30#define PX_RIGID_DYNAMIC_H
35#include "PxRigidBody.h"
36
37#if !PX_DOXYGEN
38namespace physx
39{
40#endif
41
42
49{
50 enum Enum
51 {
52 eLOCK_LINEAR_X = (1 << 0),
53 eLOCK_LINEAR_Y = (1 << 1),
54 eLOCK_LINEAR_Z = (1 << 2),
55 eLOCK_ANGULAR_X = (1 << 3),
56 eLOCK_ANGULAR_Y = (1 << 4),
57 eLOCK_ANGULAR_Z = (1 << 5)
58 };
59};
60
62PX_FLAGS_OPERATORS(PxRigidDynamicLockFlag::Enum, PxU8)
63
64
82{
83public:
84 // Runtime modifications
85
86
87/************************************************************************************************/
115 virtual void setKinematicTarget(const PxTransform& destination) = 0;
116
125 virtual bool getKinematicTarget(PxTransform& target) const = 0;
126
127
128/************************************************************************************************/
168 virtual bool isSleeping() const = 0;
169
170
182 virtual void setSleepThreshold(PxReal threshold) = 0;
183
191 virtual PxReal getSleepThreshold() const = 0;
192
206 virtual void setStabilizationThreshold(PxReal threshold) = 0;
207
217 virtual PxReal getStabilizationThreshold() const = 0;
218
219
230
244 virtual void setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value) = 0;
245 virtual void setRigidDynamicLockFlags(PxRigidDynamicLockFlags flags) = 0;
246
257 virtual PxVec3 getLinearVelocity() const = 0;
258
279 virtual void setLinearVelocity(const PxVec3& linVel, bool autowake = true) = 0;
280
291 virtual PxVec3 getAngularVelocity() const = 0;
292
312 virtual void setAngularVelocity(const PxVec3& angVel, bool autowake = true) = 0;
333 virtual void setWakeCounter(PxReal wakeCounterValue) = 0;
334
344 virtual PxReal getWakeCounter() const = 0;
345
360 virtual void wakeUp() = 0;
361
376 virtual void putToSleep() = 0;
377
378/************************************************************************************************/
379
398 virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters = 1) = 0;
399
405 virtual void getSolverIterationCounts(PxU32& minPositionIters, PxU32& minVelocityIters) const = 0;
406
426 virtual PxReal getContactReportThreshold() const = 0;
427
437 virtual void setContactReportThreshold(PxReal threshold) = 0;
438
439 virtual const char* getConcreteTypeName() const { return "PxRigidDynamic"; }
440
441protected:
442 PX_INLINE PxRigidDynamic(PxType concreteType, PxBaseFlags baseFlags) : PxRigidBody(concreteType, baseFlags) { }
443 PX_INLINE PxRigidDynamic(PxBaseFlags baseFlags) : PxRigidBody(baseFlags) {}
444 virtual ~PxRigidDynamic() {}
445 virtual bool isKindOf(const char* name) const { return !::strcmp("PxRigidDynamic", name) || PxRigidBody::isKindOf(name); }
446
447};
448
449#if !PX_DOXYGEN
450} // namespace physx
451#endif
452
454#endif
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:199
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxRigidBody.h:702
PxRigidDynamic represents a dynamic rigid simulation object in the physics SDK.
Definition PxRigidDynamic.h:82
virtual void setContactReportThreshold(PxReal threshold)=0
Sets the force threshold for contact reports.
virtual PxReal getStabilizationThreshold() const =0
Returns the mass-normalized kinetic energy below which an actor may participate in stabilization.
virtual bool isKindOf(const char *name) const
Returns whether a given type name matches with the type of this instance.
Definition PxRigidDynamic.h:445
virtual void setWakeCounter(PxReal wakeCounterValue)=0
Sets the wake counter for the actor.
virtual void wakeUp()=0
Wakes up the actor if it is sleeping.
virtual void setRigidDynamicLockFlag(PxRigidDynamicLockFlag::Enum flag, bool value)=0
Raises or clears a particular rigid dynamic lock flag.
virtual const char * getConcreteTypeName() const
Returns string name of dynamic type.
Definition PxRigidDynamic.h:439
virtual void setAngularVelocity(const PxVec3 &angVel, bool autowake=true)=0
Sets the angular velocity of the actor.
virtual void putToSleep()=0
Forces the actor to sleep.
virtual void setLinearVelocity(const PxVec3 &linVel, bool autowake=true)=0
Sets the linear velocity of the actor.
virtual PxVec3 getAngularVelocity() const =0
Retrieves the angular velocity of the actor.
virtual PxReal getSleepThreshold() const =0
Returns the mass-normalized kinetic energy below which an actor may go to sleep.
virtual void setSolverIterationCounts(PxU32 minPositionIters, PxU32 minVelocityIters=1)=0
Sets the solver iteration counts for the body.
virtual PxVec3 getLinearVelocity() const =0
Retrieves the linear velocity of an actor.
virtual bool isSleeping() const =0
Returns true if this body is sleeping.
virtual void getSolverIterationCounts(PxU32 &minPositionIters, PxU32 &minVelocityIters) const =0
Retrieves the solver iteration counts.
virtual bool getKinematicTarget(PxTransform &target) const =0
Get target pose of a kinematically controlled dynamic actor.
virtual void setKinematicTarget(const PxTransform &destination)=0
Moves kinematically controlled dynamic actors through the game world.
virtual PxRigidDynamicLockFlags getRigidDynamicLockFlags() const =0
Reads the PxRigidDynamic lock flags.
virtual void setStabilizationThreshold(PxReal threshold)=0
Sets the mass-normalized kinetic energy threshold below which an actor may participate in stabilizati...
virtual PxReal getContactReportThreshold() const =0
Retrieves the force threshold for contact reports.
virtual PxReal getWakeCounter() const =0
Returns the wake counter of the actor.
virtual void setSleepThreshold(PxReal threshold)=0
Sets the mass-normalized kinetic energy threshold below which an actor may go to sleep.
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
Collection of flags providing a mechanism to lock motion along/around a specific axis.
Definition PxRigidDynamic.h:49