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 | #ifndef PX_PHYSICS_CCT_BEHAVIOR |
14 | #define PX_PHYSICS_CCT_BEHAVIOR |
15 | /** \addtogroup character |
16 | @{ |
17 | */ |
18 | |
19 | #include "PxFiltering.h" |
20 | #include "characterkinematic/PxCharacter.h" |
21 | |
22 | #ifndef PX_DOXYGEN |
23 | namespace physx |
24 | { |
25 | #endif |
26 | |
27 | class PxShape; |
28 | class PxObstacle; |
29 | class PxController; |
30 | |
31 | /** |
32 | \brief specifies controller behavior |
33 | */ |
34 | struct PxControllerBehaviorFlag |
35 | { |
36 | enum Enum |
37 | { |
38 | eCCT_CAN_RIDE_ON_OBJECT = (1<<0), //!< Controller can ride on touched object (i.e. when this touched object is moving horizontally). \note The CCT vs. CCT case is not supported. |
39 | eCCT_SLIDE = (1<<1), //!< Controller should slide on touched object |
40 | eCCT_USER_DEFINED_RIDE = (1<<2) //!< Disable all code dealing with controllers riding on objects, let users define it outside of the SDK. |
41 | }; |
42 | }; |
43 | |
44 | /** |
45 | \brief Bitfield that contains a set of raised flags defined in PxControllerBehaviorFlag. |
46 | |
47 | @see PxControllerBehaviorFlag |
48 | */ |
49 | typedef PxFlags<PxControllerBehaviorFlag::Enum, PxU8> PxControllerBehaviorFlags; |
50 | PX_FLAGS_OPERATORS(PxControllerBehaviorFlag::Enum, PxU8) |
51 | |
52 | /** |
53 | \brief User behavior callback. |
54 | |
55 | This behavior callback is called to customize the controller's behavior w.r.t. touched shapes. |
56 | */ |
57 | class PxControllerBehaviorCallback |
58 | { |
59 | public: |
60 | //********************************************************************* |
61 | // DEPRECATED FUNCTIONS: |
62 | // |
63 | // PX_DEPRECATED virtual PxU32 getBehaviorFlags(const PxShape& shape) = 0; |
64 | // |
65 | // => replaced with: |
66 | // |
67 | // virtual PxControllerBehaviorFlags getBehaviorFlags(const PxShape& shape, const PxActor& actor) = 0; |
68 | // |
69 | // ---------------------------- |
70 | // |
71 | // PX_DEPRECATED virtual PxU32 getBehaviorFlags(const PxController& controller) = 0; |
72 | // |
73 | // => replaced with: |
74 | // |
75 | // virtual PxControllerBehaviorFlags getBehaviorFlags(const PxController& controller) = 0; |
76 | // |
77 | // ---------------------------- |
78 | // |
79 | // PX_DEPRECATED virtual PxU32 getBehaviorFlags(const PxObstacle& obstacle) = 0; |
80 | // |
81 | // => replaced with: |
82 | // |
83 | // virtual PxControllerBehaviorFlags getBehaviorFlags(const PxObstacle& obstacle) = 0; |
84 | // |
85 | //********************************************************************* |
86 | |
87 | /** |
88 | \brief Retrieve behavior flags for a shape. |
89 | |
90 | When the CCT touches a shape, the CCT's behavior w.r.t. this shape can be customized by users. |
91 | This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. |
92 | |
93 | \note See comments about deprecated functions at the start of this class |
94 | |
95 | \param[in] shape The shape the CCT is currently touching |
96 | \param[in] actor The actor owning the shape |
97 | |
98 | \return Desired behavior flags for the given shape |
99 | |
100 | @see PxControllerBehaviorFlag |
101 | */ |
102 | virtual PxControllerBehaviorFlags getBehaviorFlags(const PxShape& shape, const PxActor& actor) = 0; |
103 | |
104 | /** |
105 | \brief Retrieve behavior flags for a controller. |
106 | |
107 | When the CCT touches a controller, the CCT's behavior w.r.t. this controller can be customized by users. |
108 | This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. |
109 | |
110 | \note The flag PxControllerBehaviorFlag::eCCT_CAN_RIDE_ON_OBJECT is not supported. |
111 | \note See comments about deprecated functions at the start of this class |
112 | |
113 | \param[in] controller The controller the CCT is currently touching |
114 | |
115 | \return Desired behavior flags for the given controller |
116 | |
117 | @see PxControllerBehaviorFlag |
118 | */ |
119 | virtual PxControllerBehaviorFlags getBehaviorFlags(const PxController& controller) = 0; |
120 | |
121 | /** |
122 | \brief Retrieve behavior flags for an obstacle. |
123 | |
124 | When the CCT touches an obstacle, the CCT's behavior w.r.t. this obstacle can be customized by users. |
125 | This function retrieves the desired PxControllerBehaviorFlag flags capturing the desired behavior. |
126 | |
127 | \note See comments about deprecated functions at the start of this class |
128 | |
129 | \param[in] obstacle The obstacle the CCT is currently touching |
130 | |
131 | \return Desired behavior flags for the given obstacle |
132 | |
133 | @see PxControllerBehaviorFlag |
134 | */ |
135 | virtual PxControllerBehaviorFlags getBehaviorFlags(const PxObstacle& obstacle) = 0; |
136 | |
137 | protected: |
138 | virtual ~PxControllerBehaviorCallback(){} |
139 | }; |
140 | |
141 | #ifndef PX_DOXYGEN |
142 | } |
143 | #endif |
144 | |
145 | /** @} */ |
146 | #endif |
147 | |