Panda3D
bulletGenericConstraint.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 bulletGenericConstraint.h
10  * @author enn0x
11  * @date 2010-03-02
12  */
13 
14 #ifndef __BULLET_GENERIC_CONSTRAINT_H__
15 #define __BULLET_GENERIC_CONSTRAINT_H__
16 
17 #include "pandabase.h"
18 
19 #include "bullet_includes.h"
20 #include "bullet_utils.h"
21 #include "bulletConstraint.h"
24 
25 #include "transformState.h"
26 #include "luse.h"
27 
29 
30 /**
31  *
32  */
33 class EXPCL_PANDABULLET BulletGenericConstraint : public BulletConstraint {
34 PUBLISHED:
35  explicit BulletGenericConstraint(const BulletRigidBodyNode *node_a,
36  const TransformState *frame_a,
37  bool use_frame_a);
38  explicit BulletGenericConstraint(const BulletRigidBodyNode *node_a,
39  const BulletRigidBodyNode *node_b,
40  const TransformState *frame_a,
41  const TransformState *frame_b,
42  bool use_frame_a);
43  INLINE ~BulletGenericConstraint();
44 
45  // Geometry
46  LVector3 get_axis(int axis) const;
47  PN_stdfloat get_pivot(int axis) const;
48  PN_stdfloat get_angle(int axis) const;
49 
50  // Limit
51  void set_linear_limit(int axis, PN_stdfloat low, PN_stdfloat high);
52  void set_angular_limit(int axis, PN_stdfloat low, PN_stdfloat high);
53 
54  // Motors
55  BulletRotationalLimitMotor get_rotational_limit_motor(int axis);
56  BulletTranslationalLimitMotor get_translational_limit_motor();
57 
58  // Frames
59  void set_frames(const TransformState *ts_a, const TransformState *ts_b);
60  CPT(TransformState) get_frame_a() const;
61  CPT(TransformState) get_frame_b() const;
62 
63  MAKE_PROPERTY(translational_limit_motor, get_translational_limit_motor);
64  MAKE_PROPERTY(frame_a, get_frame_a);
65  MAKE_PROPERTY(frame_b, get_frame_b);
66 
67 public:
68  virtual btTypedConstraint *ptr() const;
69 
70 private:
71  btGeneric6DofConstraint *_constraint;
72 
73 // TODO btRotationalLimitMotor * getRotationalLimitMotor (int index)
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 
97 
98 #endif // __BULLET_GENERIC_CONSTRAINT_H__
Indicates a coordinate-system transform on vertices.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Rotation Limit structure for generic joints.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
Rotation Limit structure for generic joints.
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