Panda3D

bulletSphericalConstraint.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 bulletSphericalConstraint.h
10 * @author enn0x
11 * @date 2010-03-01
12 */
13
14 #ifndef __BULLET_SPHERICAL_CONSTRAINT_H__
15 #define __BULLET_SPHERICAL_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 "luse.h"
24
25 class BulletRigidBodyNode;
26
27 /**
28 * A constraint between two rigid bodies, each with a pivot point. The pivot
29 * points are described in the body's local space. The constraint limits
30 * movement of the two rigid bodies in such a way that the pivot points match
31 * in global space. The spherical constraint can be seen as a "ball and
32 * socket" joint.
33 */
34 class EXPCL_PANDABULLET BulletSphericalConstraint : public BulletConstraint {
35 PUBLISHED:
36 explicit BulletSphericalConstraint(const BulletRigidBodyNode *node_a,
37 const LPoint3 &pivot_a);
38 explicit BulletSphericalConstraint(const BulletRigidBodyNode *node_a,
39 const BulletRigidBodyNode *node_b,
40 const LPoint3 &pivot_a,
41 const LPoint3 &pivot_b);
42 INLINE ~BulletSphericalConstraint();
43
44 // Pivots
45 void set_pivot_a(const LPoint3 &pivot_a);
46 void set_pivot_b(const LPoint3 &pivot_b);
47 LPoint3 get_pivot_in_a() const;
48 LPoint3 get_pivot_in_b() const;
49
50 MAKE_PROPERTY(pivot_a, get_pivot_in_a, set_pivot_a);
51 MAKE_PROPERTY(pivot_b, get_pivot_in_b, set_pivot_b);
52
53 public:
54 virtual btTypedConstraint *ptr() const;
55
56 private:
57 btPoint2PointConstraint *_constraint;
58
59 public:
60 static TypeHandle get_class_type() {
61 return _type_handle;
62 }
63 static void init_type() {
64 BulletConstraint::init_type();
65 register_type(_type_handle, "BulletSphericalConstraint",
66 BulletConstraint::get_class_type());
67 }
68 virtual TypeHandle get_type() const {
69 return get_class_type();
70 }
71 virtual TypeHandle force_init_type() {
72 init_type();
73 return get_class_type();
74 }
75
76 private:
77 static TypeHandle _type_handle;
78 };
79
80 #include "bulletSphericalConstraint.I"
81
82 #endif // __BULLET_SPHERICAL_CONSTRAINT_H__
bulletConstraint.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bulletSphericalConstraint.I
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_includes.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bullet_utils.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
BulletConstraint
Definition: bulletConstraint.h:28
BulletRigidBodyNode
Definition: bulletRigidBodyNode.h:31
BulletSphericalConstraint
A constraint between two rigid bodies, each with a pivot point.
Definition: bulletSphericalConstraint.h:34
TypeHandle
TypeHandle is the identifier used to differentiate C++ class types.
Definition: typeHandle.h:81
luse.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandabase.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
register_type
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