Allow setting linked avatar positions from within a prim not the one sat on

avinationmerge
Melanie 2012-07-16 11:03:12 +02:00
parent 668723fab3
commit 12049e1120
1 changed files with 18 additions and 11 deletions

View File

@ -2469,9 +2469,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
} }
public LSL_Rotation llGetLocalRot() public LSL_Rotation llGetLocalRot()
{
return GetPartLocalRot(m_host);
}
private LSL_Rotation GetPartLocalRot(SceneObjectPart part)
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
Quaternion rot = m_host.RotationOffset; Quaternion rot = part.RotationOffset;
return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W); return new LSL_Rotation(rot.X, rot.Y, rot.Z, rot.W);
} }
@ -8029,10 +8034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
if (llGetLinkNumber() > 1) if (part.LinkNum > 1)
{ {
localRot = llGetLocalRot(); localRot = GetPartLocalRot(part);
localPos = llGetLocalPos(); localPos = GetPartLocalPos(part);
} }
v -= localPos; v -= localPos;
@ -8054,17 +8059,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
if (remain < 1) if (remain < 1)
return; return;
LSL_Rotation r;
r = rules.GetQuaternionItem(idx++);
SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
if (part == null)
break;
LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION; LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR; LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
if (llGetLinkNumber() > 1) if (part.LinkNum > 1)
{ localRot = GetPartLocalRot(part);
localRot = llGetLocalRot();
localPos = llGetLocalPos();
}
LSL_Rotation r;
r = rules.GetQuaternionItem(idx++);
r = r * llGetRootRotation() / localRot; r = r * llGetRootRotation() / localRot;
av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
av.SendAvatarDataToAllAgents(); av.SendAvatarDataToAllAgents();