diff options
author | Mic Bowman | 2012-01-13 11:37:17 -0800 |
---|---|---|
committer | Mic Bowman | 2012-01-13 11:37:17 -0800 |
commit | adea92f8b70ffc94d9dcfe775af08effaecc41ca (patch) | |
tree | 418cc84132be7847c8147cd9aae17f57a8c2629c | |
parent | Update RegionReadyModule (diff) | |
download | opensim-SC-adea92f8b70ffc94d9dcfe775af08effaecc41ca.zip opensim-SC-adea92f8b70ffc94d9dcfe775af08effaecc41ca.tar.gz opensim-SC-adea92f8b70ffc94d9dcfe775af08effaecc41ca.tar.bz2 opensim-SC-adea92f8b70ffc94d9dcfe775af08effaecc41ca.tar.xz |
Fix llRotLookAt and llLookAt for non-physical objects. Per conversation
with Melanie and Nebadon, SL behavior seems to be that non physical
objects snap to the request rotation.
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index d6de39f..30145c7 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -2861,11 +2861,18 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
2861 | // we need to convert from a vector describing | 2861 | // we need to convert from a vector describing |
2862 | // the angles of rotation in radians into rotation value | 2862 | // the angles of rotation in radians into rotation value |
2863 | 2863 | ||
2864 | LSL_Types.Quaternion rot = llEuler2Rot(angle); | 2864 | LSL_Rotation rot = llEuler2Rot(angle); |
2865 | Quaternion rotation = new Quaternion((float)rot.x, (float)rot.y, (float)rot.z, (float)rot.s); | 2865 | |
2866 | m_host.startLookAt(rotation, (float)damping, (float)strength); | 2866 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply |
2867 | // Orient the object to the angle calculated | 2867 | // set the rotation of the object, copy that behavior |
2868 | //llSetRot(rot); | 2868 | if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) |
2869 | { | ||
2870 | llSetRot(rot); | ||
2871 | } | ||
2872 | else | ||
2873 | { | ||
2874 | m_host.startLookAt(Rot2Quaternion(rot), (float)damping, (float)strength); | ||
2875 | } | ||
2869 | } | 2876 | } |
2870 | 2877 | ||
2871 | public void llStopLookAt() | 2878 | public void llStopLookAt() |
@@ -3241,8 +3248,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3241 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) | 3248 | public void llRotLookAt(LSL_Rotation target, double strength, double damping) |
3242 | { | 3249 | { |
3243 | m_host.AddScriptLPS(1); | 3250 | m_host.AddScriptLPS(1); |
3244 | Quaternion rot = new Quaternion((float)target.x, (float)target.y, (float)target.z, (float)target.s); | 3251 | |
3245 | m_host.RotLookAt(rot, (float)strength, (float)damping); | 3252 | // Per discussion with Melanie, for non-physical objects llLookAt appears to simply |
3253 | // set the rotation of the object, copy that behavior | ||
3254 | if (m_host.PhysActor == null || !m_host.PhysActor.IsPhysical) | ||
3255 | { | ||
3256 | llSetLocalRot(target); | ||
3257 | } | ||
3258 | else | ||
3259 | { | ||
3260 | m_host.RotLookAt(Rot2Quaternion(target), (float)damping, (float)strength); | ||
3261 | } | ||
3246 | } | 3262 | } |
3247 | 3263 | ||
3248 | public LSL_Integer llStringLength(string str) | 3264 | public LSL_Integer llStringLength(string str) |