does some verification of the quaternion returned by llAxes2Rot and modifies the sign of the s term if a discrepency is found. This helps llAxes2Rot more closely match the Linden implementation.
parent
bedd28e02e
commit
08f3d212ce
|
@ -452,7 +452,16 @@ namespace OpenSim.Region.ScriptEngine.Common
|
|||
if (f == 4) { x = -x; s = -s; }
|
||||
if (f == 5) { z = -z; }
|
||||
if (f == 6) { y = -y; }
|
||||
return new LSL_Types.Quaternion(x, y, z, s);
|
||||
|
||||
LSL_Types.Quaternion result = new LSL_Types.Quaternion(x, y, z, s);
|
||||
|
||||
// a hack to correct a few questionable angles :(
|
||||
LSL_Types.Vector3 fwdTest = new LSL_Types.Vector3(1, 0, 0);
|
||||
LSL_Types.Vector3 leftTest = new LSL_Types.Vector3(0, 1, 0);
|
||||
if (llVecDist(fwdTest * result, fwd) > 0.001 || llVecDist(leftTest * result, left) > 0.001)
|
||||
result.s = -s;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r)
|
||||
|
|
|
@ -439,8 +439,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
|||
if (f == 4) { x = -x; s = -s; }
|
||||
if (f == 5) { z = -z; }
|
||||
if (f == 6) { y = -y; }
|
||||
return new LSL_Types.Quaternion(x, y, z, s);
|
||||
|
||||
LSL_Types.Quaternion result = new LSL_Types.Quaternion(x, y, z, s);
|
||||
|
||||
// a hack to correct a few questionable angles :(
|
||||
LSL_Types.Vector3 fwdTest = new LSL_Types.Vector3(1, 0, 0);
|
||||
LSL_Types.Vector3 leftTest = new LSL_Types.Vector3(0, 1, 0);
|
||||
if (llVecDist(fwdTest * result, fwd) > 0.001 || llVecDist(leftTest * result, left) > 0.001)
|
||||
result.s = -s;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public LSL_Types.Vector3 llRot2Fwd(LSL_Types.Quaternion r)
|
||||
|
|
Loading…
Reference in New Issue