Panda3D

physxCapsuleController.h
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file physxCapsuleController.h
10 * @author enn0x
11 * @date 2009-09-24
12 */
13
14 #ifndef PHYSXCAPSULECONTROLLER_H
15 #define PHYSXCAPSULECONTROLLER_H
16
17 #include "pandabase.h"
18 #include "luse.h"
19
20 #include "physxController.h"
21 #include "physx_includes.h"
22
23 /**
24 * A capsule character controller.
25 *
26 * The capsule is defined as a position, a vertical height, and a radius. The
27 * height is the same height as for PhysxCapsuleShape objects, i.e. the
28 * distance between the two sphere centers at the end of the capsule. In
29 * other words:
30 *
31 * p = pos (returned by controller) h = height r = radius
32 *
33 * p = center of capsule top sphere center = p.y + h*0.5 bottom sphere center
34 * = p.y - h*0.5 top capsule point = p.y + h*0.5 + r bottom capsule point =
35 * p.y - h*0.5 - r
36 */
37 class EXPCL_PANDAPHYSX PhysxCapsuleController : public PhysxController {
38
39 PUBLISHED:
40 INLINE PhysxCapsuleController();
41 INLINE ~PhysxCapsuleController();
42
43 void set_radius(float radius);
44 void set_height(float height);
45 float get_radius() const;
46 float get_height() const;
47
48 public:
49 INLINE NxController *ptr() const { return (NxController *)_ptr; };
50
51 void link(NxController *controllerPtr);
52 void unlink();
53
54 private:
55 NxCapsuleController *_ptr;
56
57 public:
58 static TypeHandle get_class_type() {
59 return _type_handle;
60 }
61 static void init_type() {
62 PhysxController::init_type();
63 register_type(_type_handle, "PhysxCapsuleController",
64 PhysxController::get_class_type());
65 }
66 virtual TypeHandle get_type() const {
67 return get_class_type();
68 }
69 virtual TypeHandle force_init_type() {
70 init_type();
71 return get_class_type();
72 }
73
74 private:
75 static TypeHandle _type_handle;
76 };
77
78 #include "physxCapsuleController.I"
79
80 #endif // PHYSXCAPSULECONTROLLER_H
PhysxCapsuleController
A capsule character controller.
Definition: physxCapsuleController.h:37
PhysxController
Abstract base class for character controllers.
Definition: physxController.h:30
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxCapsuleController.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physxController.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
physx_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
Definition: register_type.I:22