Main Page
Class Hierarchy
Compound List
Compound Members
Include
characterkinematic
PxCapsuleController.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2008-2015, NVIDIA CORPORATION. All rights reserved.
3
*
4
* NVIDIA CORPORATION and its licensors retain all intellectual property
5
* and proprietary rights in and to this software, related documentation
6
* and any modifications thereto. Any use, reproduction, disclosure or
7
* distribution of this software and related documentation without an express
8
* license agreement from NVIDIA CORPORATION is strictly prohibited.
9
*/
10
// Copyright (c) 2004-2008 AGEIA Technologies, Inc. All rights reserved.
11
// Copyright (c) 2001-2004 NovodeX AG. All rights reserved.
12
13
14
#ifndef PX_PHYSICS_CCT_CAPSULE_CONTROLLER
15
#define PX_PHYSICS_CCT_CAPSULE_CONTROLLER
16
20
#include "
characterkinematic/PxCharacter.h
"
21
#include "
characterkinematic/PxController.h
"
22
23
#ifndef PX_DOXYGEN
24
namespace
physx
25
{
26
#endif
27
28
struct
PxCapsuleClimbingMode
29
{
30
enum
Enum
31
{
32
eEASY
,
33
eCONSTRAINED
,
34
35
eLAST
36
};
37
};
38
44
class
PxCapsuleControllerDesc
:
public
PxControllerDesc
45
{
46
public
:
50
PX_INLINE
PxCapsuleControllerDesc
();
51
PX_INLINE
virtual
~PxCapsuleControllerDesc
() {}
52
56
PX_INLINE
PxCapsuleControllerDesc(
const
PxCapsuleControllerDesc&);
57
61
PX_INLINE
PxCapsuleControllerDesc& operator=(
const
PxCapsuleControllerDesc&);
62
66
PX_INLINE
virtual
void
setToDefault();
72
PX_INLINE
virtual
bool
isValid()
const
;
73
81
PxF32
radius
;
82
90
PxF32
height
;
91
99
PxCapsuleClimbingMode::Enum
climbingMode
;
100
101
protected
:
102
PX_INLINE
void
copy(
const
PxCapsuleControllerDesc&);
103
};
104
105
PX_INLINE
PxCapsuleControllerDesc::PxCapsuleControllerDesc
() :
PxControllerDesc
(
PxControllerShapeType
::eCAPSULE)
106
{
107
radius
=
height
= 0.0f;
108
climbingMode
=
PxCapsuleClimbingMode::eEASY
;
109
}
110
111
PX_INLINE
PxCapsuleControllerDesc::PxCapsuleControllerDesc
(
const
PxCapsuleControllerDesc
& other) :
PxControllerDesc
(other)
112
{
113
copy
(other);
114
}
115
116
PX_INLINE
PxCapsuleControllerDesc
&
PxCapsuleControllerDesc::operator=
(
const
PxCapsuleControllerDesc
& other)
117
{
118
PxControllerDesc::operator=
(other);
119
copy
(other);
120
return
*
this
;
121
}
122
123
PX_INLINE
void
PxCapsuleControllerDesc::copy
(
const
PxCapsuleControllerDesc
& other)
124
{
125
radius
= other.
radius
;
126
height
= other.
height
;
127
climbingMode
= other.
climbingMode
;
128
}
129
130
PX_INLINE
void
PxCapsuleControllerDesc::setToDefault
()
131
{
132
*
this
=
PxCapsuleControllerDesc
();
133
}
134
135
PX_INLINE
bool
PxCapsuleControllerDesc::isValid
()
const
136
{
137
if
(!
PxControllerDesc::isValid
())
return
false
;
138
if
(
radius
<=0.0f)
return
false
;
139
if
(
height
<=0.0f)
return
false
;
140
if
(
stepOffset
>
height
+
radius
*2.0f)
return
false
;
// Prevents obvious mistakes
141
return
true
;
142
}
160
class
PxCapsuleController
:
public
PxController
161
{
162
public
:
163
171
virtual
PxF32
getRadius
()
const
= 0;
172
183
virtual
bool
setRadius
(
PxF32
radius) = 0;
184
192
virtual
PxF32
getHeight
()
const
= 0;
193
204
virtual
bool
setHeight
(
PxF32
height) = 0;
205
213
virtual
PxCapsuleClimbingMode::Enum
getClimbingMode
()
const
= 0;
214
222
virtual
bool
setClimbingMode
(
PxCapsuleClimbingMode::Enum
mode) = 0;
223
224
protected
:
225
PX_INLINE
PxCapsuleController
() {}
226
virtual
~PxCapsuleController
() {}
227
};
228
229
#ifndef PX_DOXYGEN
230
}
// namespace physx
231
#endif
232
234
#endif
Copyright © 2008-2015 NVIDIA Corporation, 2701 San Tomas Expressway, Santa Clara, CA 95050 U.S.A. All rights reserved.
www.nvidia.com