Panda3D
bulletGenericConstraint.h
1 // Filename: bulletGenericConstraint.h
2 // Created by: enn0x (02Mar10)
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_GENERIC_CONSTRAINT_H__
16 #define __BULLET_GENERIC_CONSTRAINT_H__
17 
18 #include "pandabase.h"
19 
20 #include "bullet_includes.h"
21 #include "bullet_utils.h"
22 #include "bulletConstraint.h"
23 #include "bulletRotationalLimitMotor.h"
24 #include "bulletTranslationalLimitMotor.h"
25 
26 #include "transformState.h"
27 #include "luse.h"
28 
30 
31 ////////////////////////////////////////////////////////////////////
32 // Class : BulletGenericConstraint
33 // Description :
34 ////////////////////////////////////////////////////////////////////
35 class EXPCL_PANDABULLET BulletGenericConstraint : public BulletConstraint {
36 
37 PUBLISHED:
39  const TransformState *frame_a,
40  bool use_frame_a);
42  const BulletRigidBodyNode *node_b,
43  const TransformState *frame_a,
44  const TransformState *frame_b,
45  bool use_frame_a);
46  INLINE ~BulletGenericConstraint();
47 
48  // Geometry
49  LVector3 get_axis(int axis) const;
50  PN_stdfloat get_pivot(int axis) const;
51  PN_stdfloat get_angle(int axis) const;
52 
53  // Limit
54  void set_linear_limit(int axis, PN_stdfloat low, PN_stdfloat high);
55  void set_angular_limit(int axis, PN_stdfloat low, PN_stdfloat high);
56 
57  // Motors
58  BulletRotationalLimitMotor get_rotational_limit_motor(int axis);
59  BulletTranslationalLimitMotor get_translational_limit_motor();
60 
61  // Frames
62  void set_frames(const TransformState *ts_a, const TransformState *ts_b);
63  INLINE CPT(TransformState) get_frame_a() const;
64  INLINE CPT(TransformState) get_frame_b() const;
65 
66 public:
67  virtual btTypedConstraint *ptr() const;
68 
69 private:
70  btGeneric6DofConstraint *_constraint;
71 
72 //TODO btRotationalLimitMotor * getRotationalLimitMotor (int index)
73 
74 ////////////////////////////////////////////////////////////////////
75 public:
76  static TypeHandle get_class_type() {
77  return _type_handle;
78  }
79  static void init_type() {
80  BulletConstraint::init_type();
81  register_type(_type_handle, "BulletGenericConstraint",
82  BulletConstraint::get_class_type());
83  }
84  virtual TypeHandle get_type() const {
85  return get_class_type();
86  }
87  virtual TypeHandle force_init_type() {
88  init_type();
89  return get_class_type();
90  }
91 
92 private:
93  static TypeHandle _type_handle;
94 };
95 
96 #include "bulletGenericConstraint.I"
97 
98 #endif // __BULLET_GENERIC_CONSTRAINT_H__
Rotation Limit structure for generic joints.
This is a three-component vector distance (as opposed to a three-component point, which represents a ...
Definition: lvector3.h:100
Rotation Limit structure for generic joints.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85