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

avinationmerge
ubit 2012-06-13 03:07:54 +02:00
commit cbeb7c8aef
2 changed files with 42 additions and 19 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;
@ -11792,6 +11800,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
LSL_List ret = new LSL_List(); LSL_List ret = new LSL_List();
UUID key = new UUID(); UUID key = new UUID();
if (UUID.TryParse(id, out key)) if (UUID.TryParse(id, out key))
{ {
ScenePresence av = World.GetScenePresence(key); ScenePresence av = World.GetScenePresence(key);
@ -11809,13 +11819,20 @@ 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:
ret.Add(new LSL_Vector((double)av.AbsolutePosition.X, (double)av.AbsolutePosition.Y, (double)av.AbsolutePosition.Z)); Vector3 avpos = av.AbsolutePosition;
ret.Add(new LSL_Vector((double)avpos.X, (double)avpos.Y, (double)avpos.Z));
break; break;
case ScriptBaseClass.OBJECT_ROT: case ScriptBaseClass.OBJECT_ROT:
ret.Add(new LSL_Rotation((double)av.Rotation.X, (double)av.Rotation.Y, (double)av.Rotation.Z, (double)av.Rotation.W)); Quaternion avrot = av.Rotation;
if(av.ParentID != 0 && av.ParentPart != null)
{
avrot = av.ParentPart.GetWorldRotation() * avrot;
}
ret.Add(new LSL_Rotation((double)avrot.X, (double)avrot.Y, (double)avrot.Z, (double)avrot.W));
break; break;
case ScriptBaseClass.OBJECT_VELOCITY: case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(av.Velocity.X, av.Velocity.Y, av.Velocity.Z)); Vector3 avvel = av.Velocity;
ret.Add(new LSL_Vector((double)avvel.X, (double)avvel.Y, (double)avvel.Z));
break; break;
case ScriptBaseClass.OBJECT_OWNER: case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(id)); ret.Add(new LSL_String(id));
@ -11875,13 +11892,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
ret.Add(new LSL_String(obj.Description)); ret.Add(new LSL_String(obj.Description));
break; break;
case ScriptBaseClass.OBJECT_POS: case ScriptBaseClass.OBJECT_POS:
ret.Add(new LSL_Vector(obj.AbsolutePosition.X, obj.AbsolutePosition.Y, obj.AbsolutePosition.Z)); Vector3 opos = obj.AbsolutePosition;
ret.Add(new LSL_Vector(opos.X, opos.Y, opos.Z));
break; break;
case ScriptBaseClass.OBJECT_ROT: case ScriptBaseClass.OBJECT_ROT:
ret.Add(new LSL_Rotation(obj.RotationOffset.X, obj.RotationOffset.Y, obj.RotationOffset.Z, obj.RotationOffset.W)); Quaternion orot = obj.RotationOffset;
ret.Add(new LSL_Rotation(orot.X, orot.Y, orot.Z, orot.W));
break; break;
case ScriptBaseClass.OBJECT_VELOCITY: case ScriptBaseClass.OBJECT_VELOCITY:
ret.Add(new LSL_Vector(obj.Velocity.X, obj.Velocity.Y, obj.Velocity.Z)); Vector3 ovel = obj.Velocity;
ret.Add(new LSL_Vector(ovel.X, ovel.Y, ovel.Z));
break; break;
case ScriptBaseClass.OBJECT_OWNER: case ScriptBaseClass.OBJECT_OWNER:
ret.Add(new LSL_String(obj.OwnerID.ToString())); ret.Add(new LSL_String(obj.OwnerID.ToString()));
@ -11919,17 +11939,19 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// The value returned in SL for normal prims is prim count // The value returned in SL for normal prims is prim count
ret.Add(new LSL_Integer(0)); ret.Add(new LSL_Integer(0));
break; break;
// costs below may need to be diferent for root parts, need to check
case ScriptBaseClass.OBJECT_SERVER_COST: case ScriptBaseClass.OBJECT_SERVER_COST:
// The value returned in SL for normal prims is prim count // The value returned in SL for normal prims is prim count
ret.Add(new LSL_Float(0)); ret.Add(new LSL_Float(0));
break; break;
case ScriptBaseClass.OBJECT_STREAMING_COST: case ScriptBaseClass.OBJECT_STREAMING_COST:
// The value returned in SL for normal prims is prim count * 0.06 // The value returned in SL for normal prims is prim count * 0.06
ret.Add(new LSL_Float(0)); ret.Add(new LSL_Float(obj.StreamingCost));
break; break;
case ScriptBaseClass.OBJECT_PHYSICS_COST: case ScriptBaseClass.OBJECT_PHYSICS_COST:
// The value returned in SL for normal prims is prim count // The value returned in SL for normal prims is prim count
ret.Add(new LSL_Float(0)); ret.Add(new LSL_Float(obj.PhysicsCost));
break; break;
default: default:
// Invalid or unhandled constant. // Invalid or unhandled constant.