aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs24
1 files changed, 21 insertions, 3 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
index 47492ea..805b344 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
@@ -3023,9 +3023,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
3023 LSL_Rotation newrot = llGetRot() * llRotBetween(new LSL_Vector(1.0d, 0.0d, 0.0d) * llGetRot(), new LSL_Vector(0.0d, 0.0d, -1.0d)); 3023 LSL_Rotation newrot = llGetRot() * llRotBetween(new LSL_Vector(1.0d, 0.0d, 0.0d) * llGetRot(), new LSL_Vector(0.0d, 0.0d, -1.0d));
3024 llSetRot(newrot * llRotBetween(new LSL_Vector(0.0d,0.0d,1.0d) * newrot, target - llGetPos())); 3024 llSetRot(newrot * llRotBetween(new LSL_Vector(0.0d,0.0d,1.0d) * newrot, target - llGetPos()));
3025 */ 3025 */
3026 // Send the target vector to RotLookAt method inside a 'rotation', the .w -99.9 value indicates it is really a LookAt. 3026 if (m_host.PhysActor != null && !m_host.PhysActor.IsPhysical)
3027 Quaternion q = new Quaternion((float)target.x, (float)target.y, (float)target.z, -99.9f); 3027 {
3028 m_host.RotLookAt(q, (float)strength, (float)damping); 3028 // Part is non-phys, convert this to a llSetRot()
3029 Vector3 tgt = new Vector3((float)target.x, (float)target.y, (float)target.z);
3030 Vector3 dir = tgt - m_host.GroupPosition;
3031 dir.Normalize();
3032 float tzrot = (float)Math.Atan2(dir.Y, dir.X);
3033 float txy = (float)Math.Sqrt((dir.X * dir.X) + (dir.Y * dir.Y));
3034 float terot = (float)Math.Atan2(-dir.Z, txy);
3035 LSL_Vector az = new LSL_Vector(0.0f, 0.0f, tzrot);
3036 LSL_Vector ae = new LSL_Vector(0.0f, terot, 0.0f);
3037 LSL_Types.Quaternion spin = llEuler2Rot(az);
3038 LSL_Types.Quaternion rot = llEuler2Rot(ae) * spin;
3039 llSetRot(rot);
3040 }
3041 else
3042 {
3043 // Physical, send the target vector to RotLookAt method inside a 'rotation', the .w -99.9 value indicates it is really a LookAt.
3044 Quaternion q = new Quaternion((float)target.x, (float)target.y, (float)target.z, -99.9f);
3045 m_host.RotLookAt(q, (float)strength, (float)damping);
3046 }
3029 3047
3030 } 3048 }
3031 3049