diff --git a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs index 57ec1ae291..781c20c943 100644 --- a/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs +++ b/OpenSim/Region/Framework/Scenes/SceneObjectPart.cs @@ -4909,25 +4909,15 @@ namespace OpenSim.Region.Framework.Scenes Quaternion currRot = GetWorldRotation(); currRot.Normalize(); - - // difference between current orientation and desired orientation - Quaternion dR = new Quaternion(currRot.X, currRot.Y, currRot.Z, -currRot.W) * APIDTarget; - // find axis of rotation to rotate to desired orientation + // difference between current orientation and desired orientation + Quaternion dR = currRot / APIDTarget; + + // find axis and angle of rotation to rotate to desired orientation Vector3 axis = Vector3.UnitX; - float s = (float)Math.Sqrt(1.0f - dR.W * dR.W); - if (s >= 0.001) - { - float invS = 1.0f / s; - if (dR.W < 0) invS = -invS; - axis = new Vector3(dR.X * invS, dR.Y * invS, dR.Z * invS) * currRot; - axis.Normalize(); - } - - // angle between current and desired orientation - float angle = 2.0f * (float)Math.Acos(dR.W); - if (angle > Math.PI) - angle = 2.0f * (float)Math.PI - angle; + float angle; + dR.GetAxisAngle(out axis, out angle); + axis = axis * currRot; // clamp strength to avoid overshoot float strength = 1.0f / APIDStrength; diff --git a/bin/OpenMetaverse.Rendering.Meshmerizer.dll b/bin/OpenMetaverse.Rendering.Meshmerizer.dll index 8a72dc30be..328bb0b1a3 100755 Binary files a/bin/OpenMetaverse.Rendering.Meshmerizer.dll and b/bin/OpenMetaverse.Rendering.Meshmerizer.dll differ diff --git a/bin/OpenMetaverse.StructuredData.dll b/bin/OpenMetaverse.StructuredData.dll index 39f439eae9..a48c62b652 100755 Binary files a/bin/OpenMetaverse.StructuredData.dll and b/bin/OpenMetaverse.StructuredData.dll differ diff --git a/bin/OpenMetaverse.dll b/bin/OpenMetaverse.dll index 1f83c3a595..618bc64cef 100755 Binary files a/bin/OpenMetaverse.dll and b/bin/OpenMetaverse.dll differ diff --git a/bin/OpenMetaverseTypes.dll b/bin/OpenMetaverseTypes.dll index ceea86b471..10401f9892 100755 Binary files a/bin/OpenMetaverseTypes.dll and b/bin/OpenMetaverseTypes.dll differ