Adjust sit target and the llSetLinkPrimitiveParams sit position hack
to match SL.avinationmerge
parent
65f5f60317
commit
1e1270166f
|
@ -91,7 +91,7 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
|
/// rotation, prim cut, prim twist, prim taper, and prim shear. See mantis
|
||||||
/// issue #1716
|
/// issue #1716
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.418f);
|
public static readonly Vector3 SIT_TARGET_ADJUSTMENT = new Vector3(0.0f, 0.0f, 0.4f);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Movement updates for agents in neighboring regions are sent directly to clients.
|
/// Movement updates for agents in neighboring regions are sent directly to clients.
|
||||||
|
@ -2301,7 +2301,27 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
|
|
||||||
//Quaternion result = (sitTargetOrient * vq) * nq;
|
//Quaternion result = (sitTargetOrient * vq) * nq;
|
||||||
|
|
||||||
m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT;
|
double x, y, z, m;
|
||||||
|
|
||||||
|
Quaternion r = sitTargetOrient;
|
||||||
|
m = r.X * r.X + r.Y * r.Y + r.Z * r.Z + r.W * r.W;
|
||||||
|
|
||||||
|
if (Math.Abs(1.0 - m) > 0.000001)
|
||||||
|
{
|
||||||
|
m = 1.0 / Math.Sqrt(m);
|
||||||
|
r.X *= (float)m;
|
||||||
|
r.Y *= (float)m;
|
||||||
|
r.Z *= (float)m;
|
||||||
|
r.W *= (float)m;
|
||||||
|
}
|
||||||
|
|
||||||
|
x = 2 * (r.X * r.Z + r.Y * r.W);
|
||||||
|
y = 2 * (-r.X * r.W + r.Y * r.Z);
|
||||||
|
z = -r.X * r.X - r.Y * r.Y + r.Z * r.Z + r.W * r.W;
|
||||||
|
|
||||||
|
Vector3 up = new Vector3((float)x, (float)y, (float)z);
|
||||||
|
Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
|
||||||
|
m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
|
||||||
Rotation = sitTargetOrient;
|
Rotation = sitTargetOrient;
|
||||||
ParentPosition = part.AbsolutePosition;
|
ParentPosition = part.AbsolutePosition;
|
||||||
part.ParentGroup.AddAvatar(UUID);
|
part.ParentGroup.AddAvatar(UUID);
|
||||||
|
|
|
@ -7542,27 +7542,59 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
|
|
||||||
int remain = rules.Length - idx;
|
int remain = rules.Length - idx;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
switch (code)
|
switch (code)
|
||||||
{
|
{
|
||||||
case (int)ScriptBaseClass.PRIM_POSITION:
|
case (int)ScriptBaseClass.PRIM_POSITION:
|
||||||
if (remain < 1)
|
{
|
||||||
return;
|
if (remain < 1)
|
||||||
LSL_Vector v;
|
return;
|
||||||
v = rules.GetVector3Item(idx++);
|
LSL_Vector v;
|
||||||
av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
|
v = rules.GetVector3Item(idx++);
|
||||||
av.SendAvatarDataToAllAgents();
|
|
||||||
|
|
||||||
|
SceneObjectPart part = World.GetSceneObjectPart(av.ParentID);
|
||||||
|
if (part == null)
|
||||||
|
break;
|
||||||
|
|
||||||
|
LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
|
||||||
|
LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
|
||||||
|
if (llGetLinkNumber() > 1)
|
||||||
|
{
|
||||||
|
localRot = llGetLocalRot();
|
||||||
|
localPos = llGetLocalPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
v -= localPos;
|
||||||
|
v /= localRot;
|
||||||
|
|
||||||
|
LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f);
|
||||||
|
|
||||||
|
v = v + 2 * sitOffset;
|
||||||
|
|
||||||
|
av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
|
||||||
|
av.SendAvatarDataToAllAgents();
|
||||||
|
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case (int)ScriptBaseClass.PRIM_ROTATION:
|
case (int)ScriptBaseClass.PRIM_ROTATION:
|
||||||
if (remain < 1)
|
{
|
||||||
return;
|
if (remain < 1)
|
||||||
LSL_Rotation r;
|
return;
|
||||||
r = rules.GetQuaternionItem(idx++);
|
|
||||||
av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
|
LSL_Rotation localRot = ScriptBaseClass.ZERO_ROTATION;
|
||||||
av.SendAvatarDataToAllAgents();
|
LSL_Vector localPos = ScriptBaseClass.ZERO_VECTOR;
|
||||||
|
if (llGetLinkNumber() > 1)
|
||||||
|
{
|
||||||
|
localRot = llGetLocalRot();
|
||||||
|
localPos = llGetLocalPos();
|
||||||
|
}
|
||||||
|
|
||||||
|
LSL_Rotation r;
|
||||||
|
r = rules.GetQuaternionItem(idx++);
|
||||||
|
r = r * llGetRootRotation() / localRot;
|
||||||
|
av.Rotation = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s);
|
||||||
|
av.SendAvatarDataToAllAgents();
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue