Panda3D
 All Classes Functions Variables Enumerations
bulletSliderConstraint.h
1 // Filename: bulletSliderConstraint.h
2 // Created by: enn0x (01Mar10)
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_SLIDER_CONSTRAINT_H__
16 #define __BULLET_SLIDER_CONSTRAINT_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 #include "bullet_utils.h"
22 #include "bulletConstraint.h"
23 
24 #include "transformState.h"
25 
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : BulletSliderConstraint
30 // Description :
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDABULLET BulletSliderConstraint : public BulletConstraint {
33 
34 PUBLISHED:
36  const TransformState *frame_a,
37  bool useFrame_a);
39  const BulletRigidBodyNode *node_b,
40  const TransformState *frame_a,
41  const TransformState *frame_b,
42  bool use_frame_a);
43  INLINE ~BulletSliderConstraint();
44 
45  PN_stdfloat get_linear_pos() const;
46  PN_stdfloat get_angular_pos() const;
47 
48  // Limits
49  PN_stdfloat get_lower_linear_limit() const;
50  PN_stdfloat get_upper_linear_limit() const;
51  PN_stdfloat get_lower_angular_limit() const;
52  PN_stdfloat get_upper_angular_limit() const;
53  void set_lower_linear_limit(PN_stdfloat value);
54  void set_upper_linear_limit(PN_stdfloat value);
55  void set_lower_angular_limit(PN_stdfloat value);
56  void set_upper_angular_limit(PN_stdfloat value);
57 
58  // Linear motor
59  void set_powered_linear_motor(bool on);
60  void set_target_linear_motor_velocity (PN_stdfloat target_velocity);
61  void set_max_linear_motor_force(PN_stdfloat max_force);
62  bool get_powered_linear_motor() const;
63  PN_stdfloat get_target_linear_motor_velocity() const;
64  PN_stdfloat get_max_linear_motor_force() const;
65 
66  // Angular motor
67  void set_powered_angular_motor(bool on);
68  void set_target_angular_motor_velocity (PN_stdfloat target_velocity);
69  void set_max_angular_motor_force(PN_stdfloat max_force);
70  bool get_powered_angular_motor() const;
71  PN_stdfloat get_target_angular_motor_velocity() const;
72  PN_stdfloat get_max_angular_motor_force() const;
73 
74  // Frames
75  void set_frames(const TransformState *ts_a, const TransformState *ts_b);
76  INLINE CPT(TransformState) get_frame_a() const;
77  INLINE CPT(TransformState) get_frame_b() const;
78 
79 public:
80  virtual btTypedConstraint *ptr() const;
81 
82 private:
83  btSliderConstraint *_constraint;
84 
85 ////////////////////////////////////////////////////////////////////
86 public:
87  static TypeHandle get_class_type() {
88  return _type_handle;
89  }
90  static void init_type() {
91  BulletConstraint::init_type();
92  register_type(_type_handle, "BulletSliderConstraint",
93  BulletConstraint::get_class_type());
94  }
95  virtual TypeHandle get_type() const {
96  return get_class_type();
97  }
98  virtual TypeHandle force_init_type() {
99  init_type();
100  return get_class_type();
101  }
102 
103 private:
104  static TypeHandle _type_handle;
105 };
106 
107 #include "bulletSliderConstraint.I"
108 
109 #endif // __BULLET_SLIDER_CONSTRAINT_H__
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85