RavEngine
Loading...
Searching...
No Matches
PxCapsuleController.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_CAPSULE_CONTROLLER_H
30#define PX_CAPSULE_CONTROLLER_H
35#include "characterkinematic/PxController.h"
36
37#if !PX_DOXYGEN
38namespace physx
39{
40#endif
41
43{
44 enum Enum
45 {
48
49 eLAST
50 };
51};
52
118
124
129
136
137PX_INLINE void PxCapsuleControllerDesc::copy(const PxCapsuleControllerDesc& other)
138{
139 radius = other.radius;
140 height = other.height;
142}
143
148
150{
151 if(!PxControllerDesc::isValid()) return false;
152 if(radius<=0.0f) return false;
153 if(height<=0.0f) return false;
154 if(stepOffset>height+radius*2.0f) return false; // Prevents obvious mistakes
155 return true;
156}
175{
176public:
177
185 virtual PxF32 getRadius() const = 0;
186
197 virtual bool setRadius(PxF32 radius) = 0;
198
206 virtual PxF32 getHeight() const = 0;
207
218 virtual bool setHeight(PxF32 height) = 0;
219
228
237
238protected:
240 virtual ~PxCapsuleController() {}
241};
242
243#if !PX_DOXYGEN
244} // namespace physx
245#endif
246
248#endif
A descriptor for a capsule character controller.
Definition PxCapsuleController.h:59
virtual PX_INLINE void setToDefault()
(re)sets the structure to the default.
Definition PxCapsuleController.h:144
PX_INLINE PxCapsuleControllerDesc()
constructor sets to default.
Definition PxCapsuleController.h:119
PX_INLINE PxCapsuleControllerDesc & operator=(const PxCapsuleControllerDesc &)
assignment operator.
Definition PxCapsuleController.h:130
PxF32 radius
The radius of the capsule.
Definition PxCapsuleController.h:95
virtual PX_INLINE bool isValid() const
returns true if the current settings are valid
Definition PxCapsuleController.h:149
PxF32 height
The height of the controller.
Definition PxCapsuleController.h:104
PxCapsuleClimbingMode::Enum climbingMode
The climbing mode.
Definition PxCapsuleController.h:113
A capsule character controller.
Definition PxCapsuleController.h:175
virtual bool setRadius(PxF32 radius)=0
Sets controller's radius.
virtual PxF32 getRadius() const =0
Gets controller's radius.
virtual bool setHeight(PxF32 height)=0
Resets controller's height.
virtual bool setClimbingMode(PxCapsuleClimbingMode::Enum mode)=0
Sets controller's climbing mode.
virtual PxF32 getHeight() const =0
Gets controller's height.
virtual PxCapsuleClimbingMode::Enum getClimbingMode() const =0
Gets controller's climbing mode.
Descriptor class for a character controller.
Definition PxController.h:300
virtual PX_INLINE bool isValid() const
returns true if the current settings are valid
Definition PxController.h:606
PX_INLINE PxControllerDesc & operator=(const PxControllerDesc &)
assignment operator.
Definition PxController.h:573
PxF32 stepOffset
Defines the maximum height of an obstacle which the character can climb.
Definition PxController.h:416
Base class for character controllers.
Definition PxController.h:638
#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
Definition PxCapsuleController.h:43
Enum
Definition PxCapsuleController.h:45
@ eCONSTRAINED
Constrained mode, try to limit climbing according to the step offset.
Definition PxCapsuleController.h:47
@ eEASY
Standard mode, let the capsule climb over surfaces according to impact normal.
Definition PxCapsuleController.h:46
The type of controller, eg box, sphere or capsule.
Definition PxController.h:49