*TEST this will affect inworld sittargets by +-0.1m, so may be very BAD *. Changed the sign of the sitoffset dependent on avatar size in SP.cs. Removed that offset correction from SET/GET..primitiveParams in LSL api. If the sign needs to be the previus one, then all references to avatar positions on LSL api need to be fixed with that correction, not only SET/GETprimitiveParams.

avinationmerge
UbitUmarov 2012-06-13 01:26:15 +01:00
parent f51ef99bd5
commit b4ab9a7350
2 changed files with 19 additions and 10 deletions

View File

@ -2383,7 +2383,8 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 up = new Vector3((float)x, (float)y, (float)z); Vector3 up = new Vector3((float)x, (float)y, (float)z);
Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f; Vector3 sitOffset = up * Appearance.AvatarHeight * 0.02638f;
m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT; // m_pos = sitTargetPos + sitOffset + SIT_TARGET_ADJUSTMENT;
m_pos = sitTargetPos + SIT_TARGET_ADJUSTMENT - sitOffset;
Rotation = sitTargetOrient; Rotation = sitTargetOrient;
ParentPosition = part.AbsolutePosition; ParentPosition = part.AbsolutePosition;
part.ParentGroup.AddAvatar(UUID); part.ParentGroup.AddAvatar(UUID);

View File

@ -7964,8 +7964,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Quaternion rot = sitpart.RotationOffset; Quaternion rot = sitpart.RotationOffset;
pos *= Quaternion.Conjugate(rot); // removed sit part rotation pos *= Quaternion.Conjugate(rot); // removed sit part rotation
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f); // Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f);
pos += sitOffset; // pos += sitOffset;
finalPos = pos; finalPos = pos;
positionChanged = true; positionChanged = true;
@ -7984,11 +7984,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested world rotation
// need to replicate SL bug // need to replicate SL bug
SceneObjectGroup sitgrp = sitpart.ParentGroup; SceneObjectGroup sitgrp = sitpart.ParentGroup;
if (sitgrp != null && sitgrp.RootPart != sitpart) if (sitgrp != null && sitgrp.RootPart != sitpart)
{ {
rot *= sitgrp.RootPart.RotationOffset; rot = sitgrp.RootPart.RotationOffset * rot;
} }
Quaternion srot = sitpart.GetWorldRotation(); Quaternion srot = sitpart.GetWorldRotation();
@ -8956,9 +8955,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break; break;
case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POSITION:
Vector3 pos = avatar.AbsolutePosition;
Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f); // can't use Abs pos to extract offset...
pos -= sitOffset; // Vector3 pos = avatar.AbsolutePosition;
Vector3 pos = avatar.OffsetPosition;
// Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f);
// pos -= sitOffset;
if( sitPart != null)
pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation();
res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z)); res.Add(new LSL_Vector(pos.X,pos.Y,pos.Z));
break; break;
@ -9153,12 +9160,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_POS_LOCAL: case (int)ScriptBaseClass.PRIM_POS_LOCAL:
Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part
// Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f);
// lpos -= lsitOffset;
if (sitPart != null) if (sitPart != null)
{ {
lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim
} }
Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f);
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;