Commits

Stinson Linden committed 9ee9387

PATH-842, VWR-29431: BUGFIX Correcting a regression introduced by the fix for PATH-542. The viewer calculated rotation resulting from an object's angular velocity was being incorrectly reset when the corresponding object update was received. With this bugfix, the rotation resulting from the angular velocity is accumulated separately and is re-appplied when the object update resets the object's rotation.

Comments (0)

Files changed (2)

indra/newview/llviewerobject.cpp

 	mNumFaces(0),
 	mTimeDilation(1.f),
 	mRotTime(0.f),
+	mAngularVelocityRot(),
 	mJointInfo(NULL),
 	mState(0),
 	mMedia(NULL),
 	{
 		mPositionAgent = mRegionp->getOriginAgent();
 	}
+	resetRot();
 
 	LLViewerObject::sNumObjects++;
 }
 	if (new_rot != getRotation()
 		|| new_angv != old_angv)
 	{
-		if (new_rot != getRotation())
+		if (new_angv != old_angv)
 		{
-			setRotation(new_rot);
+			resetRot();
 		}
-		
+
+		// Set the rotation of the object followed by adjusting for the accumulated angular velocity (llSetTargetOmega)
+		setRotation(new_rot * mAngularVelocityRot);
 		setChanged(ROTATED | SILHOUETTE);
-		
-		resetRot();
 	}
 
 
 
 		ang_vel *= 1.f/omega;
 		
+		// calculate the delta increment based on the object's angular velocity
 		dQ.setQuat(angle, ang_vel);
+
+		// accumulate the angular velocity rotations to re-apply in the case of an object update
+		mAngularVelocityRot *= dQ;
 		
+		// Just apply the delta increment to the current rotation
 		setRotation(getRotation()*dQ);
 		setChanged(MOVED | SILHOUETTE);
 	}
 void LLViewerObject::resetRot()
 {
 	mRotTime = 0.0f;
+
+	// Reset the accumulated angular velocity rotation
+	mAngularVelocityRot.loadIdentity(); 
 }
 
 U32 LLViewerObject::getPartitionType() const

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
 
 	LLVOJointInfo*  mJointInfo;
 	U8				mState;	// legacy