Panda3D
|
00001 // Filename: bulletConeTwistConstraint.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_CONE_TWIST_CONSTRAINT_H__ 00016 #define __BULLET_CONE_TWIST_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 "transformState.h" 00025 00026 class BulletRigidBodyNode; 00027 00028 //////////////////////////////////////////////////////////////////// 00029 // Class : BulletConeTwistConstraint 00030 // Description : 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDABULLET BulletConeTwistConstraint : public BulletConstraint { 00033 00034 PUBLISHED: 00035 BulletConeTwistConstraint(const BulletRigidBodyNode *node_a, 00036 CPT(TransformState) frame_a); 00037 BulletConeTwistConstraint(const BulletRigidBodyNode *node_a, 00038 const BulletRigidBodyNode *node_b, 00039 CPT(TransformState) frame_a, 00040 CPT(TransformState) frame_b); 00041 INLINE ~BulletConeTwistConstraint(); 00042 00043 void set_limit(int index, PN_stdfloat value); 00044 void set_limit(PN_stdfloat swing1, PN_stdfloat swing2, PN_stdfloat twist, PN_stdfloat softness=1.0f, PN_stdfloat bias=0.3f, PN_stdfloat relaxation=1.0f); 00045 00046 void set_damping(PN_stdfloat damping); 00047 00048 PN_stdfloat get_fix_threshold() const; 00049 void set_fix_threshold(PN_stdfloat threshold); 00050 00051 void enable_motor(bool enable); 00052 void set_max_motor_impulse(PN_stdfloat max_impulse); 00053 void set_max_motor_impulse_normalized(PN_stdfloat max_impulse); 00054 void set_motor_target(const LQuaternion &quat); 00055 void set_motor_target_in_constraint_space(const LQuaternion &quat); 00056 00057 public: 00058 virtual btTypedConstraint *ptr() const; 00059 00060 private: 00061 btConeTwistConstraint *_constraint; 00062 00063 //////////////////////////////////////////////////////////////////// 00064 public: 00065 static TypeHandle get_class_type() { 00066 return _type_handle; 00067 } 00068 static void init_type() { 00069 BulletConstraint::init_type(); 00070 register_type(_type_handle, "BulletConeTwistConstraint", 00071 BulletConstraint::get_class_type()); 00072 } 00073 virtual TypeHandle get_type() const { 00074 return get_class_type(); 00075 } 00076 virtual TypeHandle force_init_type() { 00077 init_type(); 00078 return get_class_type(); 00079 } 00080 00081 private: 00082 static TypeHandle _type_handle; 00083 }; 00084 00085 #include "bulletConeTwistConstraint.I" 00086 00087 #endif // __BULLET_CONE_TWIST_CONSTRAINT_H__