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