Panda3D
bulletConeTwistConstraint.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 bulletConeTwistConstraint.h
10  * @author enn0x
11  * @date 2010-03-01
12  */
13 
14 #ifndef __BULLET_CONE_TWIST_CONSTRAINT_H__
15 #define __BULLET_CONE_TWIST_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 BulletConeTwistConstraint : public BulletConstraint {
31 
32 PUBLISHED:
33  explicit BulletConeTwistConstraint(const BulletRigidBodyNode *node_a,
34  const TransformState *frame_a);
35  explicit BulletConeTwistConstraint(const BulletRigidBodyNode *node_a,
36  const BulletRigidBodyNode *node_b,
37  const TransformState *frame_a,
38  const TransformState *frame_b);
39  INLINE ~BulletConeTwistConstraint();
40 
41  void set_limit(int index, PN_stdfloat value);
42  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);
43 
44  void set_damping(PN_stdfloat damping);
45 
46  PN_stdfloat get_fix_threshold() const;
47  void set_fix_threshold(PN_stdfloat threshold);
48 
49  void enable_motor(bool enable);
50  void set_max_motor_impulse(PN_stdfloat max_impulse);
51  void set_max_motor_impulse_normalized(PN_stdfloat max_impulse);
52  void set_motor_target(const LQuaternion &quat);
53  void set_motor_target_in_constraint_space(const LQuaternion &quat);
54 
55  void set_frames(const TransformState *ts_a, const TransformState *ts_b);
56  CPT(TransformState) get_frame_a() const;
57  CPT(TransformState) get_frame_b() const;
58 
59  MAKE_PROPERTY(fix_threshold, get_fix_threshold, set_fix_threshold);
60  MAKE_PROPERTY(frame_a, get_frame_a);
61  MAKE_PROPERTY(frame_b, get_frame_b);
62 
63 public:
64  virtual btTypedConstraint *ptr() const;
65 
66 private:
67  btConeTwistConstraint *_constraint;
68 
69 public:
70  static TypeHandle get_class_type() {
71  return _type_handle;
72  }
73  static void init_type() {
74  BulletConstraint::init_type();
75  register_type(_type_handle, "BulletConeTwistConstraint",
76  BulletConstraint::get_class_type());
77  }
78  virtual TypeHandle get_type() const {
79  return get_class_type();
80  }
81  virtual TypeHandle force_init_type() {
82  init_type();
83  return get_class_type();
84  }
85 
86 private:
87  static TypeHandle _type_handle;
88 };
89 
91 
92 #endif // __BULLET_CONE_TWIST_CONSTRAINT_H__
Indicates a coordinate-system transform on vertices.
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
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81