Merge branch 'master' of ssh://opensimulator.org/var/git/opensim

fsassets
Diva Canto 2015-06-11 11:31:44 -07:00
commit fe116b6af7
5 changed files with 7 additions and 17 deletions

View File

@ -4909,25 +4909,15 @@ namespace OpenSim.Region.Framework.Scenes
Quaternion currRot = GetWorldRotation(); Quaternion currRot = GetWorldRotation();
currRot.Normalize(); 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; Vector3 axis = Vector3.UnitX;
float s = (float)Math.Sqrt(1.0f - dR.W * dR.W); float angle;
if (s >= 0.001) dR.GetAxisAngle(out axis, out angle);
{ axis = axis * currRot;
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;
// clamp strength to avoid overshoot // clamp strength to avoid overshoot
float strength = 1.0f / APIDStrength; float strength = 1.0f / APIDStrength;

Binary file not shown.

Binary file not shown.

Binary file not shown.