Panda3D
bulletSliderConstraint.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 bulletSliderConstraint.h
10  * @author enn0x
11  * @date 2010-03-01
12  */
13 
14 #ifndef __BULLET_SLIDER_CONSTRAINT_H__
15 #define __BULLET_SLIDER_CONSTRAINT_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bullet_utils.h"
21 #include "bulletConstraint.h"
22 
23 #include "transformState.h"
24 
26 
27 /**
28  *
29  */
30 class EXPCL_PANDABULLET BulletSliderConstraint : public BulletConstraint {
31 PUBLISHED:
32  explicit BulletSliderConstraint(const BulletRigidBodyNode *node_a,
33  const TransformState *frame_a,
34  bool useFrame_a);
35  explicit BulletSliderConstraint(const BulletRigidBodyNode *node_a,
36  const BulletRigidBodyNode *node_b,
37  const TransformState *frame_a,
38  const TransformState *frame_b,
39  bool use_frame_a);
40  INLINE ~BulletSliderConstraint();
41 
42  PN_stdfloat get_linear_pos() const;
43  PN_stdfloat get_angular_pos() const;
44 
45  // Limits
46  PN_stdfloat get_lower_linear_limit() const;
47  PN_stdfloat get_upper_linear_limit() const;
48  PN_stdfloat get_lower_angular_limit() const;
49  PN_stdfloat get_upper_angular_limit() const;
50  void set_lower_linear_limit(PN_stdfloat value);
51  void set_upper_linear_limit(PN_stdfloat value);
52  void set_lower_angular_limit(PN_stdfloat value);
53  void set_upper_angular_limit(PN_stdfloat value);
54 
55  // Linear motor
56  void set_powered_linear_motor(bool on);
57  void set_target_linear_motor_velocity (PN_stdfloat target_velocity);
58  void set_max_linear_motor_force(PN_stdfloat max_force);
59  bool get_powered_linear_motor() const;
60  PN_stdfloat get_target_linear_motor_velocity() const;
61  PN_stdfloat get_max_linear_motor_force() const;
62 
63  // Angular motor
64  void set_powered_angular_motor(bool on);
65  void set_target_angular_motor_velocity (PN_stdfloat target_velocity);
66  void set_max_angular_motor_force(PN_stdfloat max_force);
67  bool get_powered_angular_motor() const;
68  PN_stdfloat get_target_angular_motor_velocity() const;
69  PN_stdfloat get_max_angular_motor_force() const;
70 
71  // Frames
72  void set_frames(const TransformState *ts_a, const TransformState *ts_b);
73  CPT(TransformState) get_frame_a() const;
74  CPT(TransformState) get_frame_b() const;
75 
76  MAKE_PROPERTY(linear_pos, get_linear_pos);
77  MAKE_PROPERTY(angular_pos, get_angular_pos);
78  MAKE_PROPERTY(lower_linear_limit, get_lower_linear_limit, set_lower_linear_limit);
79  MAKE_PROPERTY(upper_linear_limit, get_upper_linear_limit, set_upper_linear_limit);
80  MAKE_PROPERTY(lower_angular_limit, get_lower_angular_limit, set_lower_angular_limit);
81  MAKE_PROPERTY(upper_angular_limit, get_upper_angular_limit, set_upper_angular_limit);
82  MAKE_PROPERTY(powered_linear_motor, get_powered_linear_motor, set_powered_linear_motor);
83  MAKE_PROPERTY(target_linear_motor_velocity, get_target_linear_motor_velocity, set_target_linear_motor_velocity);
84  MAKE_PROPERTY(max_linear_motor_force, get_max_linear_motor_force, set_max_linear_motor_force);
85  MAKE_PROPERTY(powered_angular_motor, get_powered_angular_motor, set_powered_angular_motor);
86  MAKE_PROPERTY(target_angular_motor_velocity, get_target_angular_motor_velocity, set_target_angular_motor_velocity);
87  MAKE_PROPERTY(max_angular_motor_force, get_max_angular_motor_force, set_max_angular_motor_force);
88  MAKE_PROPERTY(frame_a, get_frame_a);
89  MAKE_PROPERTY(frame_b, get_frame_b);
90 
91 public:
92  virtual btTypedConstraint *ptr() const;
93 
94 private:
95  btSliderConstraint *_constraint;
96 
97 public:
98  static TypeHandle get_class_type() {
99  return _type_handle;
100  }
101  static void init_type() {
102  BulletConstraint::init_type();
103  register_type(_type_handle, "BulletSliderConstraint",
104  BulletConstraint::get_class_type());
105  }
106  virtual TypeHandle get_type() const {
107  return get_class_type();
108  }
109  virtual TypeHandle force_init_type() {
110  init_type();
111  return get_class_type();
112  }
113 
114 private:
115  static TypeHandle _type_handle;
116 };
117 
118 #include "bulletSliderConstraint.I"
119 
120 #endif // __BULLET_SLIDER_CONSTRAINT_H__
BulletRigidBodyNode
Definition: bulletRigidBodyNode.h:31
BulletSliderConstraint
Definition: bulletSliderConstraint.h:30
bulletConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.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
bulletSliderConstraint.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
transformState.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_utils.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TransformState
Indicates a coordinate-system transform on vertices.
Definition: transformState.h:54
BulletConstraint
Definition: bulletConstraint.h:28