aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared/Api/Implementation
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-06-03 23:43:09 +0100
committerJustin Clark-Casey (justincc)2011-06-03 23:43:09 +0100
commit66004a9375bdb736b4e2569f2791ac14ed4925e4 (patch)
treec45a0bcc3fc466cab6880207972ba07e1bfc2d69 /OpenSim/Region/ScriptEngine/Shared/Api/Implementation
parentminor: add in method print out to new test (diff)
downloadopensim-SC-66004a9375bdb736b4e2569f2791ac14ed4925e4.zip
opensim-SC-66004a9375bdb736b4e2569f2791ac14ed4925e4.tar.gz
opensim-SC-66004a9375bdb736b4e2569f2791ac14ed4925e4.tar.bz2
opensim-SC-66004a9375bdb736b4e2569f2791ac14ed4925e4.tar.xz
If an llSensor() is in an attachment, make the detection cone face in the direction of the avatar, not the relative rotation of the attachment towards the avatar.
This is effectively a copy/paste from 459323a, which should be refactored sometime. This seems the obvious problem from field reports but I have not tested the fix myself. Feedback welcome.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared/Api/Implementation')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs11
1 files changed, 10 insertions, 1 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 47c7915..e53a61a 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -308,7 +308,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
308 // In attachments, the sensor cone always orients with the 308 // In attachments, the sensor cone always orients with the
309 // avatar rotation. This may include a nonzero elevation if 309 // avatar rotation. This may include a nonzero elevation if
310 // in mouselook. 310 // in mouselook.
311
312 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar); 311 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
313 q = avatar.Rotation; 312 q = avatar.Rotation;
314 } 313 }
@@ -422,7 +421,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
422 421
423 SceneObjectPart SensePoint = ts.host; 422 SceneObjectPart SensePoint = ts.host;
424 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 423 Vector3 fromRegionPos = SensePoint.AbsolutePosition;
424
425 Quaternion q = SensePoint.RotationOffset; 425 Quaternion q = SensePoint.RotationOffset;
426 if (SensePoint.ParentGroup.RootPart.IsAttachment)
427 {
428 // In attachments, the sensor cone always orients with the
429 // avatar rotation. This may include a nonzero elevation if
430 // in mouselook.
431 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
432 q = avatar.Rotation;
433 }
434
426 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 435 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
427 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 436 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
428 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir); 437 double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);