Panda3D
|
00001 // Filename: bulletSliderConstraint.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_SLIDER_CONSTRAINT_H__ 00016 #define __BULLET_SLIDER_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 : BulletSliderConstraint 00030 // Description : 00031 //////////////////////////////////////////////////////////////////// 00032 class EXPCL_PANDABULLET BulletSliderConstraint : public BulletConstraint { 00033 00034 PUBLISHED: 00035 BulletSliderConstraint(const BulletRigidBodyNode *node_a, 00036 CPT(TransformState) frame_a, 00037 bool useFrame_a); 00038 BulletSliderConstraint(const BulletRigidBodyNode *node_a, 00039 const BulletRigidBodyNode *node_b, 00040 CPT(TransformState) frame_a, 00041 CPT(TransformState) frame_b, 00042 bool use_frame_a); 00043 INLINE ~BulletSliderConstraint(); 00044 00045 PN_stdfloat get_linear_pos() const; 00046 PN_stdfloat get_angular_pos() const; 00047 00048 // Limits 00049 PN_stdfloat get_lower_linear_limit() const; 00050 PN_stdfloat get_upper_linear_limit() const; 00051 PN_stdfloat get_lower_angular_limit() const; 00052 PN_stdfloat get_upper_angular_limit() const; 00053 void set_lower_linear_limit(PN_stdfloat value); 00054 void set_upper_linear_limit(PN_stdfloat value); 00055 void set_lower_angular_limit(PN_stdfloat value); 00056 void set_upper_angular_limit(PN_stdfloat value); 00057 00058 // Linear motor 00059 void set_powered_linear_motor(bool on); 00060 void set_target_linear_motor_velocity (PN_stdfloat target_velocity); 00061 void set_max_linear_motor_force(PN_stdfloat max_force); 00062 bool get_powered_linear_motor() const; 00063 PN_stdfloat get_target_linear_motor_velocity() const; 00064 PN_stdfloat get_max_linear_motor_force() const; 00065 00066 // Angular motor 00067 void set_powered_angular_motor(bool on); 00068 void set_target_angular_motor_velocity (PN_stdfloat target_velocity); 00069 void set_max_angular_motor_force(PN_stdfloat max_force); 00070 bool get_powered_angular_motor() const; 00071 PN_stdfloat get_target_angular_motor_velocity() const; 00072 PN_stdfloat get_max_angular_motor_force() const; 00073 00074 public: 00075 virtual btTypedConstraint *ptr() const; 00076 00077 private: 00078 btSliderConstraint *_constraint; 00079 00080 //////////////////////////////////////////////////////////////////// 00081 public: 00082 static TypeHandle get_class_type() { 00083 return _type_handle; 00084 } 00085 static void init_type() { 00086 BulletConstraint::init_type(); 00087 register_type(_type_handle, "BulletSliderConstraint", 00088 BulletConstraint::get_class_type()); 00089 } 00090 virtual TypeHandle get_type() const { 00091 return get_class_type(); 00092 } 00093 virtual TypeHandle force_init_type() { 00094 init_type(); 00095 return get_class_type(); 00096 } 00097 00098 private: 00099 static TypeHandle _type_handle; 00100 }; 00101 00102 #include "bulletSliderConstraint.I" 00103 00104 #endif // __BULLET_SLIDER_CONSTRAINT_H__