Make the detection cone in attachments face in the direction of the avatar,

not the relative rotation of the attachment towards the avatar.
avinationmerge
Melanie 2010-04-21 19:44:19 +01:00
parent 50f327ef5c
commit 459323a931
1 changed files with 9 additions and 0 deletions

View File

@ -302,6 +302,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Plugins
float dz;
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.Vector3 forward_dir = (new LSL_Types.Vector3(1, 0, 0) * r);
double mag_fwd = LSL_Types.Vector3.Mag(forward_dir);