PxControllerObstacles.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_PHYSICS_CCT_OBSTACLES
31 #define PX_PHYSICS_CCT_OBSTACLES
32 
37 #include "geometry/PxGeometry.h"
38 
39 #if !PX_DOXYGEN
40 namespace physx
41 {
42 #endif
43 
44  class PxControllerManager;
45 
46  #define INVALID_OBSTACLE_HANDLE 0xffffffff
47 
53  class PxObstacle
54  {
55  protected:
57  mType (PxGeometryType::eINVALID),
58  mUserData (NULL),
59  mPos (0.0, 0.0, 0.0),
60  mRot (PxQuat(PxIdentity))
61  {}
62 
64  public:
65 
66  PX_FORCE_INLINE PxGeometryType::Enum getType() const { return mType; }
67 
68  void* mUserData;
71  };
72 
78  class PxBoxObstacle : public PxObstacle
79  {
80  public:
82  mHalfExtents(0.0f)
83  { mType = PxGeometryType::eBOX; }
84 
86  };
87 
94  {
95  public:
97  mHalfHeight (0.0f),
98  mRadius (0.0f)
99  { mType = PxGeometryType::eCAPSULE; }
100 
103  };
104 
106 
115  {
116  public:
118  virtual ~PxObstacleContext() {}
119 
123  virtual void release() = 0;
124 
130  virtual PxControllerManager& getControllerManager() const = 0;
131 
139  virtual ObstacleHandle addObstacle(const PxObstacle& obstacle) = 0;
140 
148  virtual bool removeObstacle(ObstacleHandle handle) = 0;
149 
158  virtual bool updateObstacle(ObstacleHandle handle, const PxObstacle& obstacle) = 0;
159 
165  virtual PxU32 getNbObstacles() const = 0;
166 
174  virtual const PxObstacle* getObstacle(PxU32 i) const = 0;
175 
183  virtual const PxObstacle* getObstacleByHandle(ObstacleHandle handle) const = 0;
184  };
185 
186 #if !PX_DOXYGEN
187 }
188 #endif
189 
191 #endif
Definition: GuContactBuffer.h:37
PxReal mHalfHeight
Definition: PxControllerObstacles.h:101
PxReal mRadius
Definition: PxControllerObstacles.h:102
Definition: Px.h:84
PxGeometryType::Enum mType
Definition: PxControllerObstacles.h:63
PxObstacleContext()
Definition: PxControllerObstacles.h:117
A geometry type.
Definition: PxGeometry.h:51
#define PX_FORCE_INLINE
Definition: PxPreprocessor.h:351
PxVec3 mHalfExtents
Definition: PxControllerObstacles.h:85
This is a quaternion class. For more information on quaternion mathematics consult a mathematics sour...
Definition: PxQuat.h:49
float PxReal
Definition: PxSimpleTypes.h:78
PX_FORCE_INLINE PxGeometryType::Enum getType() const
Definition: PxControllerObstacles.h:66
Definition: PxGeometry.h:57
PxBoxObstacle()
Definition: PxControllerObstacles.h:81
virtual ~PxObstacleContext()
Definition: PxControllerObstacles.h:118
PxExtendedVec3 mPos
Definition: PxControllerObstacles.h:69
PxObstacle()
Definition: PxControllerObstacles.h:56
A box obstacle.
Definition: PxControllerObstacles.h:78
Context class for obstacles.
Definition: PxControllerObstacles.h:114
Manages an array of character controllers.
Definition: PxControllerManager.h:84
Base class for obstacles.
Definition: PxControllerObstacles.h:53
Enum
Definition: PxGeometry.h:53
PxU32 ObstacleHandle
Definition: PxControllerObstacles.h:105
A capsule obstacle.
Definition: PxControllerObstacles.h:93
Definition: PxGeometry.h:58
void * mUserData
Definition: PxControllerObstacles.h:68
uint32_t PxU32
Definition: Px.h:48
PxCapsuleObstacle()
Definition: PxControllerObstacles.h:96
PxQuat mRot
Definition: PxControllerObstacles.h:70
3 Element vector class.
Definition: PxVec3.h:49
Definition: PxExtended.h:56