Game Development Community

T2dSceneObject::updateMount() and tracking rotation (with fix)

by Ken Pajala · in Torque Game Builder · 04/22/2007 (5:59 pm) · 0 replies

With the code:
// No, so are we mounted rigidly?
			if ( mMountForce != 0 )
			{
				// No, so calculate direction to mount position.
				F32 delta = mFmod(mountRotation - oldRotation, 360.0f);

				// Fetch rotation Magnitude.
				F32 magnitude = mFabs(delta);
				if (magnitude > 180)
					delta *= -1;

I believe the last line should be:
delta -= 360;
Otherwise large magnitudes cause odd rotational flickering of the mounted object.