Merge branch 'ubitwork' of ssh://3dhosting.de/var/git/careminster into ubitwork

avinationmerge
ubit 2012-06-13 06:13:22 +02:00
commit 88438c097a
2 changed files with 47 additions and 28 deletions

View File

@ -2383,8 +2383,10 @@ 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 + SIT_TARGET_ADJUSTMENT - sitOffset; 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

@ -7099,7 +7099,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
// LSL quaternions can normalize to 0, normal Quaternions can't. // LSL quaternions can normalize to 0, normal Quaternions can't.
if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0) if (rot.s == 0 && rot.x == 0 && rot.y == 0 && rot.z == 0)
rot.z = 1; // ZERO_ROTATION = 0,0,0,1 rot.s = 1; // ZERO_ROTATION = 0,0,0,1
part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z); part.SitTargetPosition = new Vector3((float)offset.x, (float)offset.y, (float)offset.z);
part.SitTargetOrientation = Rot2Quaternion(rot); part.SitTargetOrientation = Rot2Quaternion(rot);
@ -7959,13 +7959,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position Vector3 pos = new Vector3((float)v.x, (float)v.y, (float)v.z); // requested absolute position
pos -= sitpart.OffsetPosition; // remove sit part offset if (sitpart != sitpart.ParentGroup.RootPart)
{
Quaternion rot = sitpart.RotationOffset; pos -= sitpart.OffsetPosition; // remove sit part offset
pos *= Quaternion.Conjugate(rot); // removed sit part rotation Quaternion rot = sitpart.RotationOffset;
pos *= Quaternion.Conjugate(rot); // removed sit part rotation
// Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f); }
// pos += sitOffset; Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f * 2.0f);
pos += sitOffset;
finalPos = pos; finalPos = pos;
positionChanged = true; positionChanged = true;
@ -7990,8 +7991,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
rot = sitgrp.RootPart.RotationOffset * rot; rot = sitgrp.RootPart.RotationOffset * rot;
} }
Quaternion srot = sitpart.GetWorldRotation(); Quaternion srot = sitpart.RotationOffset;
rot = Quaternion.Conjugate(srot) * rot; // removed sit part world rotation rot = Quaternion.Conjugate(srot) * rot; // removed sit part offset rotation
av.Rotation = rot; av.Rotation = rot;
av.SendAvatarDataToAllAgents(); av.SendAvatarDataToAllAgents();
} }
@ -8007,10 +8008,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_Rotation r = rules.GetQuaternionItem(idx++); LSL_Rotation r = rules.GetQuaternionItem(idx++);
Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation Quaternion rot = new Quaternion((float)r.x, (float)r.y, (float)r.z, (float)r.s); // requested offset rotation
if (sitpart != sitpart.ParentGroup.RootPart)
Quaternion srot = sitpart.RotationOffset; {
rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation Quaternion srot = sitpart.RotationOffset;
rot = Quaternion.Conjugate(srot) * rot; // remove sit part offset rotation
}
av.Rotation = rot; av.Rotation = rot;
av.SendAvatarDataToAllAgents(); av.SendAvatarDataToAllAgents();
} }
@ -8956,12 +8958,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_POSITION: case (int)ScriptBaseClass.PRIM_POSITION:
// can't use Abs pos to extract offset...
// Vector3 pos = avatar.AbsolutePosition;
Vector3 pos = avatar.OffsetPosition; Vector3 pos = avatar.OffsetPosition;
// Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f); Vector3 sitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f *2.0f);
// pos -= sitOffset; pos -= sitOffset;
if( sitPart != null) if( sitPart != null)
pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation(); pos = sitPart.GetWorldPosition() + pos * sitPart.GetWorldRotation();
@ -9151,7 +9151,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
case (int)ScriptBaseClass.PRIM_ROT_LOCAL: case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
Quaternion lrot = avatar.Rotation; Quaternion lrot = avatar.Rotation;
if (sitPart != null)
if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart)
{ {
lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset
} }
@ -9160,10 +9161,10 @@ 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); Vector3 lsitOffset = (Zrot(avatar.Rotation)) * (avatar.Appearance.AvatarHeight * 0.02638f * 2.0f);
// lpos -= lsitOffset; lpos -= lsitOffset;
if (sitPart != null) if (sitPart != null && sitPart != sitPart.ParentGroup.RootPart)
{ {
lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim
} }
@ -11819,12 +11820,25 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_String("")); ret.Add(new LSL_String(""));
break; break;
case ScriptBaseClass.OBJECT_POS: case ScriptBaseClass.OBJECT_POS:
Vector3 avpos = av.AbsolutePosition; Vector3 avpos;
if (av.ParentID != 0 && av.ParentPart != null)
{
avpos = av.OffsetPosition;
Vector3 sitOffset = (Zrot(av.Rotation)) * (av.Appearance.AvatarHeight * 0.02638f *2.0f);
avpos -= sitOffset;
avpos = av.ParentPart.GetWorldPosition() + avpos * av.ParentPart.GetWorldRotation();
}
else
avpos = av.AbsolutePosition;
ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z)); ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z));
break; break;
case ScriptBaseClass.OBJECT_ROT: case ScriptBaseClass.OBJECT_ROT:
Quaternion avrot = av.Rotation; Quaternion avrot = av.Rotation;
if(av.ParentID != 0 && av.ParentPart != null) if (av.ParentID != 0 && av.ParentPart != null)
{ {
avrot = av.ParentPart.GetWorldRotation() * avrot; avrot = av.ParentPart.GetWorldRotation() * avrot;
} }
@ -11896,8 +11910,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z)); ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
break; break;
case ScriptBaseClass.OBJECT_ROT: case ScriptBaseClass.OBJECT_ROT:
Quaternion orot = obj.RotationOffset; // Quaternion orot = obj.RotationOffset;
ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W)); // ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W));
LSL_Rotation objrot = GetPartRot(obj);
ret.Add(objrot);
break; break;
case ScriptBaseClass.OBJECT_VELOCITY: case ScriptBaseClass.OBJECT_VELOCITY:
Vector3 ovel = obj.Velocity; Vector3 ovel = obj.Velocity;