aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/Shared
diff options
context:
space:
mode:
authorStefan_Boom2012-04-14 22:05:16 +0200
committerJustin Clark-Casey (justincc)2012-04-27 19:31:50 +0100
commitb35a1d56818386fc70a4a71e3cd8f6dd6d0e2193 (patch)
treeae99126e04e246a2eed875732a884ead1b9b8bbf /OpenSim/Region/ScriptEngine/Shared
parentMapImageService: changed the event at which the map tiles are uploaded, becau... (diff)
downloadopensim-SC_OLD-b35a1d56818386fc70a4a71e3cd8f6dd6d0e2193.zip
opensim-SC_OLD-b35a1d56818386fc70a4a71e3cd8f6dd6d0e2193.tar.gz
opensim-SC_OLD-b35a1d56818386fc70a4a71e3cd8f6dd6d0e2193.tar.bz2
opensim-SC_OLD-b35a1d56818386fc70a4a71e3cd8f6dd6d0e2193.tar.xz
Fixing wrong position of llSensor, SensePoint wasnt following the rotation of the root prim.
Diffstat (limited to 'OpenSim/Region/ScriptEngine/Shared')
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs30
1 files changed, 22 insertions, 8 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
index 1c272f8..57f741c 100644
--- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
+++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/Plugins/SensorRepeat.cs
@@ -308,7 +308,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
308 } 308 }
309 SceneObjectPart SensePoint = ts.host; 309 SceneObjectPart SensePoint = ts.host;
310 310
311 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 311 Vector3 fromRegionPos = SensePoint.GetWorldPosition();
312 312
313 // pre define some things to avoid repeated definitions in the loop body 313 // pre define some things to avoid repeated definitions in the loop body
314 Vector3 toRegionPos; 314 Vector3 toRegionPos;
@@ -319,14 +319,21 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
319 float dy; 319 float dy;
320 float dz; 320 float dz;
321 321
322 Quaternion q = SensePoint.RotationOffset; 322 Quaternion q = SensePoint.GetWorldRotation();
323 if (SensePoint.ParentGroup.IsAttachment) 323 if (SensePoint.ParentGroup.IsAttachment)
324 { 324 {
325 // In attachments, the sensor cone always orients with the 325 // In attachments, rotate the sensor cone with the
326 // avatar rotation. This may include a nonzero elevation if 326 // avatar rotation. This may include a nonzero elevation if
327 // in mouselook. 327 // in mouselook.
328 // This will not include the rotation and position of the
329 // attachment point (e.g. your head when a sensor is in your
330 // hair attached to your scull. Your hair will turn with
331 // your head but the sensor will stay with your (global)
332 // avatar rotation and position.
333 // Position of a sensor in a child prim attached to an avatar
334 // will be still wrong.
328 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); 335 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
329 q = avatar.Rotation; 336 q = avatar.Rotation*q;
330 } 337 }
331 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 338 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
332 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r); 339 LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
@@ -439,16 +446,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
439 return sensedEntities; 446 return sensedEntities;
440 447
441 SceneObjectPart SensePoint = ts.host; 448 SceneObjectPart SensePoint = ts.host;
442 Vector3 fromRegionPos = SensePoint.AbsolutePosition; 449 Vector3 fromRegionPos = SensePoint.GetWorldPosition();
443 450
444 Quaternion q = SensePoint.RotationOffset; 451 Quaternion q = SensePoint.GetWorldRotation();
445 if (SensePoint.ParentGroup.IsAttachment) 452 if (SensePoint.ParentGroup.IsAttachment)
446 { 453 {
447 // In attachments, the sensor cone always orients with the 454 // In attachments, rotate the sensor cone with the
448 // avatar rotation. This may include a nonzero elevation if 455 // avatar rotation. This may include a nonzero elevation if
449 // in mouselook. 456 // in mouselook.
457 // This will not include the rotation and position of the
458 // attachment point (e.g. your head when a sensor is in your
459 // hair attached to your scull. Your hair will turn with
460 // your head but the sensor will stay with your (global)
461 // avatar rotation and position.
462 // Position of a sensor in a child prim attached to an avatar
463 // will be still wrong.
450 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar); 464 ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.AttachedAvatar);
451 q = avatar.Rotation; 465 q = avatar.Rotation*q;
452 } 466 }
453 467
454 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W); 468 LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);