Panda3D
bulletCharacterControllerNode.h
1 // Filename: bulletCharacterControllerNode.h
2 // Created by: enn0x (21Nov10)
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 __BULLET_CHARACTER_CONTROLLER_NODE_H__
16 #define __BULLET_CHARACTER_CONTROLLER_NODE_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 #include "bullet_utils.h"
22 #include "bulletShape.h"
23 #include "bulletBaseCharacterControllerNode.h"
24 
25 #include "luse.h"
26 #include "transformState.h"
27 #include "nodePath.h"
28 
29 ////////////////////////////////////////////////////////////////////
30 // Class : BulletCharacterControllerNode
31 // Description :
32 ////////////////////////////////////////////////////////////////////
34 
35 PUBLISHED:
36  BulletCharacterControllerNode(BulletShape *shape, PN_stdfloat step_height, const char *name="character");
38 
39  void set_linear_movement(const LVector3 &velocity, bool is_local);
40  void set_angular_movement(PN_stdfloat omega);
41 
42  BulletShape *get_shape() const;
43 
44  PN_stdfloat get_gravity() const;
45  PN_stdfloat get_max_slope() const;
46 
47  void set_fall_speed(PN_stdfloat fall_speed);
48  void set_jump_speed(PN_stdfloat jump_speed);
49  void set_max_jump_height(PN_stdfloat max_jump_height);
50  void set_max_slope(PN_stdfloat max_slope);
51  void set_gravity(PN_stdfloat gravity);
52  void set_use_ghost_sweep_test(bool value);
53 
54  bool is_on_ground() const;
55  bool can_jump() const;
56  void do_jump();
57 
58 public:
59  INLINE virtual btPairCachingGhostObject *get_ghost() const;
60  INLINE virtual btCharacterControllerInterface *get_character() const;
61 
62  virtual void sync_p2b(PN_stdfloat dt, int num_substeps);
63  virtual void sync_b2p();
64 
65 protected:
66  virtual void transform_changed();
67 
68 private:
69  CPT(TransformState) _sync;
70  bool _sync_disable;
71 
72  BulletUpAxis _up;
73 
74  btKinematicCharacterController *_character;
75  btPairCachingGhostObject *_ghost;
76 
77  PT(BulletShape) _shape;
78 
79  LVector3 _linear_movement;
80  bool _linear_movement_is_local;
81  PN_stdfloat _angular_movement;
82 
83 ////////////////////////////////////////////////////////////////////
84 public:
85  static TypeHandle get_class_type() {
86  return _type_handle;
87  }
88  static void init_type() {
89  BulletBaseCharacterControllerNode::init_type();
90  register_type(_type_handle, "BulletCharacterControllerNode",
91  BulletBaseCharacterControllerNode::get_class_type());
92  }
93  virtual TypeHandle get_type() const {
94  return get_class_type();
95  }
96  virtual TypeHandle force_init_type() {
97  init_type();
98  return get_class_type();
99  }
100 
101 private:
102  static TypeHandle _type_handle;
103 };
104 
105 #include "bulletCharacterControllerNode.I"
106 
107 #endif // __BULLET_CHARACTER_CONTROLLER_NODE_H__
108 
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85