Here is the code from OgreNewt's v2 rigid joint. The chassis kind of.. sags and squirms like a spider that's been sprayed
The builtin hinge joint in newton v2 doesn't work the same as 1.53 because the calculateStopAlpha seems to blow up on me.
In the end I'm trying to make a joint that can have bend limits and forces which I can use for permanent chassis damage. I'm guessing I'll need a full joint like the 6dof joint?
Thanks!
edit: I've tried so many things now, I've just got zero idea how these work. Just when I think I understand it it turns out I don't. Is there any documentation at all for these explaining concepts aswell?
- Code: Select all
void Chassis::Beam::submitConstraint( Ogre::Real timeStep, int threadIndex )
{
// get globals.
Ogre::Vector3 globalPos0, globalPos1;
Ogre::Quaternion globalOrient0, globalOrient1;
localToGlobal( mLocalOrient0, mLocalPos0, globalOrient0, globalPos0, 0 );
localToGlobal( mLocalOrient1, mLocalPos1, globalOrient1, globalPos1, 1 );
setStiffness(1.0f);
// apply the constraints!
addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre::Vector3::UNIT_X );
addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre::Vector3::UNIT_Y );
addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre::Vector3::UNIT_Z );
// now find a point off 10 units away.
globalPos0 = globalPos0 + (globalOrient0 * (Ogre::Vector3::UNIT_X * 10.0f));
globalPos1 = globalPos1 + (globalOrient1 * (Ogre::Vector3::UNIT_X * 10.0f));
// apply the constraints!
addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre::Vector3::UNIT_Y );
addLinearRow( globalPos0, globalPos1, globalOrient0 * Ogre::Vector3::UNIT_Z );
Ogre::Vector3 xdir0 = globalOrient0 * Ogre::Vector3::UNIT_X;
Ogre::Vector3 xdir1 = globalOrient1 * Ogre::Vector3::UNIT_X;
//Ogre::Radian angle = Ogre::Math::ACos( xdir0.dotProduct( xdir1 ) );
Ogre::Radian angle = 0;
addAngularRow( angle, globalOrient0 * Ogre::Vector3::UNIT_X );
}