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.
bulletsim
parent
d09210da86
commit
66004a9375
|
@ -308,7 +308,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
// In attachments, the sensor cone always orients with the
|
// In attachments, the sensor cone always orients with the
|
||||||
// avatar rotation. This may include a nonzero elevation if
|
// avatar rotation. This may include a nonzero elevation if
|
||||||
// in mouselook.
|
// in mouselook.
|
||||||
|
|
||||||
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
|
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
|
||||||
q = avatar.Rotation;
|
q = avatar.Rotation;
|
||||||
}
|
}
|
||||||
|
@ -422,7 +421,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
|
||||||
|
|
||||||
SceneObjectPart SensePoint = ts.host;
|
SceneObjectPart SensePoint = ts.host;
|
||||||
Vector3 fromRegionPos = SensePoint.AbsolutePosition;
|
Vector3 fromRegionPos = SensePoint.AbsolutePosition;
|
||||||
|
|
||||||
Quaternion q = SensePoint.RotationOffset;
|
Quaternion q = SensePoint.RotationOffset;
|
||||||
|
if (SensePoint.ParentGroup.RootPart.IsAttachment)
|
||||||
|
{
|
||||||
|
// In attachments, the sensor cone always orients with the
|
||||||
|
// avatar rotation. This may include a nonzero elevation if
|
||||||
|
// in mouselook.
|
||||||
|
ScenePresence avatar = m_CmdManager.m_ScriptEngine.World.GetScenePresence(SensePoint.ParentGroup.RootPart.AttachedAvatar);
|
||||||
|
q = avatar.Rotation;
|
||||||
|
}
|
||||||
|
|
||||||
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
|
LSL_Types.Quaternion r = new LSL_Types.Quaternion(q.X, q.Y, q.Z, q.W);
|
||||||
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
|
LSL_Types.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
|
||||||
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
|
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);
|
||||||
|
|
Loading…
Reference in New Issue