Panda3D
|
00001 // Filename: bulletSphericalConstraint.h 00002 // Created by: enn0x (01Mar10) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 #ifndef __BULLET_SPHERICAL_CONSTRAINT_H__ 00016 #define __BULLET_SPHERICAL_CONSTRAINT_H__ 00017 00018 #include "pandabase.h" 00019 00020 #include "bullet_includes.h" 00021 #include "bullet_utils.h" 00022 #include "bulletConstraint.h" 00023 00024 #include "luse.h" 00025 00026 class BulletRigidBodyNode; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : BulletSphericalConstraint 00030 // Description : A constraint between two rigid bodies, each with a 00031 // pivot point. The pivot points are described in the 00032 // body's local space. The constraint limits movement 00033 // of the two rigid bodies in such a way that the 00034 // pivot points match in global space. The spherical 00035 // constraint can be seen as a "ball and socket" 00036 // joint. 00037 //////////////////////////////////////////////////////////////////// 00038 class EXPCL_PANDABULLET BulletSphericalConstraint : public BulletConstraint { 00039 00040 PUBLISHED: 00041 BulletSphericalConstraint(const BulletRigidBodyNode *node_a, 00042 const LPoint3 &pivot_a); 00043 BulletSphericalConstraint(const BulletRigidBodyNode *node_a, 00044 const BulletRigidBodyNode *node_b, 00045 const LPoint3 &pivot_a, 00046 const LPoint3 &pivot_b); 00047 INLINE ~BulletSphericalConstraint(); 00048 00049 void set_pivot_a(const LPoint3 &pivot_a); 00050 void set_pivot_b(const LPoint3 &pivot_b); 00051 00052 LPoint3 get_pivot_in_a() const; 00053 LPoint3 get_pivot_in_b() const; 00054 00055 public: 00056 virtual btTypedConstraint *ptr() const; 00057 00058 private: 00059 btPoint2PointConstraint *_constraint; 00060 00061 //////////////////////////////////////////////////////////////////// 00062 public: 00063 static TypeHandle get_class_type() { 00064 return _type_handle; 00065 } 00066 static void init_type() { 00067 BulletConstraint::init_type(); 00068 register_type(_type_handle, "BulletSphericalConstraint", 00069 BulletConstraint::get_class_type()); 00070 } 00071 virtual TypeHandle get_type() const { 00072 return get_class_type(); 00073 } 00074 virtual TypeHandle force_init_type() { 00075 init_type(); 00076 return get_class_type(); 00077 } 00078 00079 private: 00080 static TypeHandle _type_handle; 00081 }; 00082 00083 #include "bulletSphericalConstraint.I" 00084 00085 #endif // __BULLET_SPHERICAL_CONSTRAINT_H__