|
From: Markus R. <rol...@us...> - 2006-02-19 13:15:35
|
Update of /cvsroot/simspark/simspark/spark/oxygen/physicsserver In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24038 Modified Files: hingejoint.h hingejoint.cpp Log Message: - added method SetAxis() that takes an arbitrary axis vector Index: hingejoint.cpp =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/hingejoint.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** hingejoint.cpp 12 Feb 2006 11:36:52 -0000 1.4 --- hingejoint.cpp 19 Feb 2006 13:15:26 -0000 1.5 *************** *** 85,97 **** { // calculate hinge axis (pos. x, relative to world transform) ! Vector3f right(GetWorldTransform().Rotate(Vector3f(1,0,0))); ! dJointSetHingeAxis(mODEJoint, right[0], right[1], right[2]); break; } case AI_SECOND: { ! // calculate hinge axis (pos. y, relative to world transform) ! Vector3f forward(GetWorldTransform().Rotate(Vector3f(0,1,0))); ! dJointSetHingeAxis(mODEJoint, forward[0], forward[1], forward[2]); break; } --- 85,95 ---- { // calculate hinge axis (pos. x, relative to world transform) ! SetAxis(Vector3f(1,0,0)); break; } case AI_SECOND: { ! // calculate hinge axis (pos. y, relative to world transform) ! SetAxis(Vector3f(0,1,0)); break; } *************** *** 99,104 **** { // calculate hinge axis (pos. z, relative to world transform) ! Vector3f up(GetWorldTransform().Rotate(Vector3f(0,0,1))); ! dJointSetHingeAxis(mODEJoint, up[0], up[1], up[2]); break; } --- 97,101 ---- { // calculate hinge axis (pos. z, relative to world transform) ! SetAxis(Vector3f(0,0,1)); break; } *************** *** 108,111 **** --- 105,114 ---- } + void HingeJoint::SetAxis(const Vector3f& axis) + { + Vector3f absAxis(GetWorldTransform().Rotate(axis)); + dJointSetHingeAxis(mODEJoint, absAxis[0], absAxis[1], absAxis[2]); + } + Vector3f HingeJoint::GetAxis() { Index: hingejoint.h =================================================================== RCS file: /cvsroot/simspark/simspark/spark/oxygen/physicsserver/hingejoint.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** hingejoint.h 12 Feb 2006 11:36:52 -0000 1.4 --- hingejoint.h 19 Feb 2006 13:15:26 -0000 1.5 *************** *** 45,55 **** salt::Vector3f GetAnchor(EBodyIndex idx); ! /** Sets the joint axis. The connected bodies movements will be ! constrained to move around this axis. */ void SetAxis(EAxisIndex idx); ! /** Returns the hinge axis in the local coordinate system ! */ salt::Vector3f GetAxis(); --- 45,61 ---- salt::Vector3f GetAnchor(EBodyIndex idx); ! /** Sets the joint axis in the local coordinate system. The ! connected bodies movements will be constrained to move around ! this axis. */ void SetAxis(EAxisIndex idx); ! /** Sets the joint axis in the local coordinate system. The ! connected bodies movements will be constrained to move around ! this axis. ! */ ! void SetAxis(const salt::Vector3f& axis); ! ! /** Returns the hinge axis in the local coordinate system */ salt::Vector3f GetAxis(); |