diff options
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 5be8929..75dd615 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2881,6 +2881,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2881 | 2881 | ||
2882 | public void llLookAt(LSL_Vector target, double strength, double damping) | 2882 | public void llLookAt(LSL_Vector target, double strength, double damping) |
2883 | { | 2883 | { |
2884 | /* | ||
2884 | m_host.AddScriptLPS(1); | 2885 | m_host.AddScriptLPS(1); |
2885 | // Determine where we are looking from | 2886 | // Determine where we are looking from |
2886 | LSL_Vector from = llGetPos(); | 2887 | LSL_Vector from = llGetPos(); |
@@ -2900,12 +2901,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2900 | // the angles of rotation in radians into rotation value | 2901 | // the angles of rotation in radians into rotation value |
2901 | 2902 | ||
2902 | LSL_Types.Quaternion rot = llEuler2Rot(angle); | 2903 | LSL_Types.Quaternion rot = llEuler2Rot(angle); |
2903 | /* | 2904 | |
2904 | Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); | 2905 | // This would only work if your physics system contains an APID controller: |
2905 | m_host.startLookAt(rotation, (float)damping, (float)strength); | 2906 | // Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); |
2906 | This would only work if your physics system contains an APID controller */ | 2907 | // m_host.startLookAt(rotation, (float)damping, (float)strength); |
2908 | |||
2907 | // Orient the object to the angle calculated | 2909 | // Orient the object to the angle calculated |
2908 | llSetRot(rot); | 2910 | llSetRot(rot); |
2911 | */ | ||
2912 | |||
2913 | //The above code, while nice, doesn't replicate the behaviour of SL and tends to "roll" the object. | ||
2914 | //There's probably a smarter way of doing this, my rotation math-fu is weak. | ||
2915 | // http://bugs.meta7.com/view.php?id=28 | ||
2916 | // - Tom | ||
2917 | |||
2918 | LSL_Rotation newrot = llGetRot() * llRotBetween(new LSL_Vector(1.0d, 0.0d, 0.0d) * llGetRot(), new LSL_Vector(0.0d, 0.0d, -1.0d)); | ||
2919 | llSetRot(newrot * llRotBetween(new LSL_Vector(0.0d,0.0d,1.0d) * newrot, target - llGetPos())); | ||
2920 | |||
2909 | } | 2921 | } |
2910 | 2922 | ||
2911 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | 2923 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) |