mirror of
https://github.com/opensim/opensim.git
synced 2026-08-01 22:26:09 +08:00
Mantis #2217
Guard against NaN being returned from llRotBetween. Return a zero rotation if the result is NaN.
This commit is contained in:
@@ -581,7 +581,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
LSL_Types.Vector3 axis = LSL_Types.Vector3.Norm(crossProduct);
|
||||
double s = Math.Sin(angle / 2);
|
||||
|
||||
return new LSL_Types.Quaternion(axis.x * s, axis.y * s, axis.z * s, (float)Math.Cos(angle / 2));
|
||||
double x = axis.x * s;
|
||||
double y = axis.y * s;
|
||||
double z = axis.z * s;
|
||||
double w = Math.Cos(angle / 2);
|
||||
|
||||
if(Double.IsNaN(x) || Double.IsNaN(y) || Double.IsNaN(z) || Double.IsNaN(w))
|
||||
return new LSL_Types.Quaternion(0.0f, 0.0f, 0.0f, 1.0f);
|
||||
|
||||
return new LSL_Types.Quaternion((float)x, (float)y, (float)z, (float)w);
|
||||
}
|
||||
|
||||
public void llWhisper(int channelID, string text)
|
||||
|
||||
Reference in New Issue
Block a user