diff options
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs index 1c152be..0c17a90 100644 --- a/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs +++ b/OpenSim/Region/ScriptEngine/Shared/LSL_Types.cs | |||
@@ -270,13 +270,15 @@ namespace OpenSim.Region.ScriptEngine.Shared | |||
270 | // Vector-Rotation Math | 270 | // Vector-Rotation Math |
271 | public static Vector3 operator *(Vector3 v, Quaternion r) | 271 | public static Vector3 operator *(Vector3 v, Quaternion r) |
272 | { | 272 | { |
273 | Quaternion vq = new Quaternion(v.x, v.y, v.z, 0); | 273 | double rx = r.s * v.x + r.y * v.z - r.z * v.y; |
274 | Quaternion nq = new Quaternion(-r.x, -r.y, -r.z, r.s); | 274 | double ry = r.s * v.y + r.z * v.x - r.x * v.z; |
275 | double rz = r.s * v.z + r.x * v.y - r.y * v.x; | ||
275 | 276 | ||
276 | // adapted for operator * computing "b * a" | 277 | v.x += 2.0f * (rz * r.y - ry * r.z); |
277 | Quaternion result = nq * (vq * r); | 278 | v.y += 2.0f * (rx * r.z - rz * r.x); |
279 | v.z += 2.0f * (ry * r.x - rx * r.y); | ||
278 | 280 | ||
279 | return new Vector3(result.x, result.y, result.z); | 281 | return v; |
280 | } | 282 | } |
281 | 283 | ||
282 | public static Vector3 operator /(Vector3 v, Quaternion r) | 284 | public static Vector3 operator /(Vector3 v, Quaternion r) |