Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

sliderjoint.cpp

Go to the documentation of this file.
00001 /* -*- mode: c++; c-basic-offset: 4; indent-tabs-mode: nil -*-
00002    this file is part of rcssserver3D
00003    Fri May 9 2003
00004    Copyright (C) 2003 Koblenz University
00005    $Id: sliderjoint.cpp,v 1.3 2004/05/01 11:30:31 rollmark Exp $
00006 
00007    This program is free software; you can redistribute it and/or modify
00008    it under the terms of the GNU General Public License as published by
00009    the Free Software Foundation; version 2 of the License.
00010 
00011    This program is distributed in the hope that it will be useful,
00012    but WITHOUT ANY WARRANTY; without even the implied warranty of
00013    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014    GNU General Public License for more details.
00015 
00016    You should have received a copy of the GNU General Public License
00017    along with this program; if not, write to the Free Software
00018    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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     // relative slider axis points up
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 

Generated on Thu Apr 6 15:25:40 2006 for rcssserver3d by  doxygen 1.4.4