00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "sliderjoint.h"
00021 #include <zeitgeist/logserver/logserver.h>
00022
00023 using namespace oxygen;
00024 using namespace boost;
00025 using namespace salt;
00026
00027 SliderJoint::SliderJoint() : Joint()
00028 {
00029 }
00030
00031 SliderJoint::~SliderJoint()
00032 {
00033 }
00034
00035 void SliderJoint::OnLink()
00036 {
00037 dWorldID world = GetWorldID();
00038 if (world == 0)
00039 {
00040 return;
00041 }
00042
00043 mODEJoint = dJointCreateSlider(world, 0);
00044 }
00045
00046 void SliderJoint::Attach(shared_ptr<Body> body1, shared_ptr<Body> body2)
00047 {
00048 Joint::Attach(body1,body2);
00049
00050
00051 Vector3f up(GetWorldTransform().Rotate(Vector3f(0,0,1)));
00052 dJointSetSliderAxis(mODEJoint,up[0],up[1],up[2]);
00053 }
00054
00055 float SliderJoint::GetPosition()
00056 {
00057 return dJointGetSliderPosition(mODEJoint);
00058 }
00059
00060 float SliderJoint::GetPositionRate()
00061 {
00062 return dJointGetSliderPositionRate(mODEJoint);
00063 }
00064
00065 void SliderJoint::SetParameter(int parameter, float value)
00066 {
00067 dJointSetSliderParam(mODEJoint, parameter, value);
00068 }
00069
00070 float SliderJoint::GetParameter(int parameter)
00071 {
00072 return dJointGetSliderParam(mODEJoint, parameter);
00073 }
00074
00075
00076
00077
00078