Panda3D
bulletSphericalConstraint.h
1 // Filename: bulletSphericalConstraint.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_SPHERICAL_CONSTRAINT_H__
16 #define __BULLET_SPHERICAL_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 "luse.h"
25 
27 
28 ////////////////////////////////////////////////////////////////////
29 // Class : BulletSphericalConstraint
30 // Description : A constraint between two rigid bodies, each with a
31 // pivot point. The pivot points are described in the
32 // body's local space. The constraint limits movement
33 // of the two rigid bodies in such a way that the
34 // pivot points match in global space. The spherical
35 // constraint can be seen as a "ball and socket"
36 // joint.
37 ////////////////////////////////////////////////////////////////////
38 class EXPCL_PANDABULLET BulletSphericalConstraint : public BulletConstraint {
39 
40 PUBLISHED:
42  const LPoint3 &pivot_a);
44  const BulletRigidBodyNode *node_b,
45  const LPoint3 &pivot_a,
46  const LPoint3 &pivot_b);
47  INLINE ~BulletSphericalConstraint();
48 
49  // Pivots
50  void set_pivot_a(const LPoint3 &pivot_a);
51  void set_pivot_b(const LPoint3 &pivot_b);
52  LPoint3 get_pivot_in_a() const;
53  LPoint3 get_pivot_in_b() const;
54 
55 public:
56  virtual btTypedConstraint *ptr() const;
57 
58 private:
59  btPoint2PointConstraint *_constraint;
60 
61 ////////////////////////////////////////////////////////////////////
62 public:
63  static TypeHandle get_class_type() {
64  return _type_handle;
65  }
66  static void init_type() {
67  BulletConstraint::init_type();
68  register_type(_type_handle, "BulletSphericalConstraint",
69  BulletConstraint::get_class_type());
70  }
71  virtual TypeHandle get_type() const {
72  return get_class_type();
73  }
74  virtual TypeHandle force_init_type() {
75  init_type();
76  return get_class_type();
77  }
78 
79 private:
80  static TypeHandle _type_handle;
81 };
82 
83 #include "bulletSphericalConstraint.I"
84 
85 #endif // __BULLET_SPHERICAL_CONSTRAINT_H__
This is a three-component point in space (as opposed to a three-component vector, which represents a ...
Definition: lpoint3.h:99
A constraint between two rigid bodies, each with a pivot point.
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:85