From d48ea5bb797037069d641da41da0f195f0124491 Mon Sep 17 00:00:00 2001 From: dan miller Date: Fri, 19 Oct 2007 05:20:48 +0000 Subject: one more for the gipper --- .../ode-0.9/contrib/DotNetManaged/JointBall.cpp | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp (limited to 'libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp') diff --git a/libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp b/libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp new file mode 100644 index 0000000..d9336c9 --- /dev/null +++ b/libraries/ode-0.9/contrib/DotNetManaged/JointBall.cpp @@ -0,0 +1,79 @@ +#include "StdAfx.h" + +#include +#include "jointball.h" + +namespace ODEManaged +{ + + //Constructors + + JointBall::JointBall(void) : Joint(){} + + + JointBall::JointBall(World &world) + { + if(this->_id) dJointDestroy(this->_id); + _id = dJointCreateBall(world.Id(), 0); + } + + + JointBall::JointBall(World &world, JointGroup &jointGroup) + { + if(this->_id) dJointDestroy(this->_id); + _id = dJointCreateBall(world.Id(), jointGroup.Id()); + } + + + //Destructor + + JointBall::~JointBall(void){} + + + //Methods + + //Overloaded Create + void JointBall::Create(World &world, JointGroup &jointGroup) + { + if(this->_id) dJointDestroy(this->_id); + _id = dJointCreateBall(world.Id(), jointGroup.Id()); + } + + void JointBall::Create(World &world) + { + if(this->_id) dJointDestroy(this->_id); + _id = dJointCreateBall(world.Id(), 0); + } + + + //Overloaded Attach + void JointBall::Attach(Body &body1, Body &body2) + { + dJointAttach(this->_id, body1.Id(), body2.Id()); + } + + void JointBall::Attach(Body &body1) + { + dJointAttach(this->_id, body1.Id(), 0); + } + + + //SetAnchor + void JointBall::SetAnchor(double x, double y ,double z) + { + dJointSetBallAnchor(this->_id, x, y, z); + } + + //GetAnchor + Vector3 JointBall::GetAnchor(void) + { + Vector3 retVal; + dVector3 temp; + dJointGetBallAnchor(this->_id,temp); + retVal.x = temp[0]; + retVal.y = temp[1]; + retVal.z = temp[2]; + return retVal; + } + +} -- cgit v1.1