Commits

Stinson Linden committed ceed0b6

MAINT-1561: BUGFIX Another target omega fix for an issue detected with a clock pendulum.

  • Participants
  • Parent commits d027596
  • Tags DRTVWR-215

Comments (0)

Files changed (2)

indra/newview/llviewerobject.cpp

 	mTimeDilation(1.f),
 	mRotTime(0.f),
 	mAngularVelocityRot(),
+	mPreviousRotation(),
 	mJointInfo(NULL),
 	mState(0),
 	mMedia(NULL),
 		}
 	}
 
-	if (new_rot != getRotation()
-		|| new_angv != old_angv)
-	{
-		if (new_angv != old_angv)
+	if ((new_rot != getRotation())
+		|| (new_angv != old_angv))
+	{
+		if (new_rot != mPreviousRotation)
+		{
+			resetRot();
+		}
+		else if (new_angv != old_angv)
 		{
 			if (flagUsePhysics() || new_angv.isExactlyZero())
 			{
 			}
 		}
 
+		// Remember the last rotation value
+		mPreviousRotation = new_rot;
+
 		// Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega)
 		setRotation(new_rot * mAngularVelocityRot);
 		setChanged(ROTATED | SILHOUETTE);

indra/newview/llviewerobject.h

 	F32				mTimeDilation;				// Time dilation sent with the object.
 	F32				mRotTime;					// Amount (in seconds) that object has rotated according to angular velocity (llSetTargetOmega)
 	LLQuaternion	mAngularVelocityRot;		// accumulated rotation from the angular velocity computations
+	LLQuaternion	mPreviousRotation;
 
 	LLVOJointInfo*  mJointInfo;
 	U8				mState;	// legacy