add LegacySitOffsets handling at LSL api

LSLKeyTest
UbitUmarov 2015-11-17 18:17:11 +00:00
parent da5aad87bf
commit 62cacff071
1 changed files with 22 additions and 8 deletions

View File

@ -13483,8 +13483,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
avpos = av.OffsetPosition; avpos = av.OffsetPosition;
if(!av.LegacySitOffsets)
{
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f); Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f);
avpos -= sitOffset; avpos -= sitOffset;
}
SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart; SceneObjectPart sitRoot = av.ParentPart.ParentGroup.RootPart;
avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation(); avpos = sitRoot.GetWorldPosition() + avpos * sitRoot.GetWorldRotation();
} }
@ -15731,9 +15735,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Vector v; LSL_Vector v;
v = rules.GetVector3Item(idx++); v = rules.GetVector3Item(idx++);
if(!av.LegacySitOffsets)
{
LSL_Vector sitOffset = (llRot2Up(new LSL_Rotation(av.Rotation.X, av.Rotation.Y, av.Rotation.Z, av.Rotation.W)) * av.Appearance.AvatarHeight * 0.02638f); 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; v = v + 2 * sitOffset;
}
av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z); av.OffsetPosition = new Vector3((float)v.x, (float)v.y, (float)v.z);
positionChanged = true; positionChanged = true;
@ -15910,8 +15917,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
pos = avatar.OffsetPosition; pos = avatar.OffsetPosition;
if(!avatar.LegacySitOffsets)
{
Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f); Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f);
pos -= sitOffset; pos -= sitOffset;
}
SceneObjectPart sitroot = sitPart.ParentGroup.RootPart; SceneObjectPart sitroot = sitPart.ParentGroup.RootPart;
pos = sitroot.AbsolutePosition + pos * sitroot.GetWorldRotation(); pos = sitroot.AbsolutePosition + pos * sitroot.GetWorldRotation();
@ -16104,8 +16114,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_POS_LOCAL: case (int)ScriptBaseClass.PRIM_POS_LOCAL:
Vector3 lpos = avatar.OffsetPosition; Vector3 lpos = avatar.OffsetPosition;
if(!avatar.LegacySitOffsets)
{
Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f); Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f);
lpos -= lsitOffset; lpos -= lsitOffset;
}
res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z)); res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
break; break;