Panda3D
bulletConeTwistConstraint.h
1 // Filename: bulletConeTwistConstraint.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_CONE_TWIST_CONSTRAINT_H__
16 #define __BULLET_CONE_TWIST_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 : BulletConeTwistConstraint
30 // Description :
31 ////////////////////////////////////////////////////////////////////
32 class EXPCL_PANDABULLET BulletConeTwistConstraint : public BulletConstraint {
33 
34 PUBLISHED:
36  const TransformState *frame_a);
38  const BulletRigidBodyNode *node_b,
39  const TransformState *frame_a,
40  const TransformState *frame_b);
41  INLINE ~BulletConeTwistConstraint();
42 
43  void set_limit(int index, PN_stdfloat value);
44  void set_limit(PN_stdfloat swing1, PN_stdfloat swing2, PN_stdfloat twist, PN_stdfloat softness=1.0f, PN_stdfloat bias=0.3f, PN_stdfloat relaxation=1.0f);
45 
46  void set_damping(PN_stdfloat damping);
47 
48  PN_stdfloat get_fix_threshold() const;
49  void set_fix_threshold(PN_stdfloat threshold);
50 
51  void enable_motor(bool enable);
52  void set_max_motor_impulse(PN_stdfloat max_impulse);
53  void set_max_motor_impulse_normalized(PN_stdfloat max_impulse);
54  void set_motor_target(const LQuaternion &quat);
55  void set_motor_target_in_constraint_space(const LQuaternion &quat);
56 
57  void set_frames(const TransformState *ts_a, const TransformState *ts_b);
58  INLINE CPT(TransformState) get_frame_a() const;
59  INLINE CPT(TransformState) get_frame_b() const;
60 
61 public:
62  virtual btTypedConstraint *ptr() const;
63 
64 private:
65  btConeTwistConstraint *_constraint;
66 
67 ////////////////////////////////////////////////////////////////////
68 public:
69  static TypeHandle get_class_type() {
70  return _type_handle;
71  }
72  static void init_type() {
73  BulletConstraint::init_type();
74  register_type(_type_handle, "BulletConeTwistConstraint",
75  BulletConstraint::get_class_type());
76  }
77  virtual TypeHandle get_type() const {
78  return get_class_type();
79  }
80  virtual TypeHandle force_init_type() {
81  init_type();
82  return get_class_type();
83  }
84 
85 private:
86  static TypeHandle _type_handle;
87 };
88 
89 #include "bulletConeTwistConstraint.I"
90 
91 #endif // __BULLET_CONE_TWIST_CONSTRAINT_H__
This is the base quaternion class.
Definition: lquaternion.h:96
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85