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

avinationmerge
ubit 2012-06-12 03:22:19 +02:00
commit aad7b4a192
2 changed files with 22 additions and 39 deletions

View File

@ -519,40 +519,6 @@ namespace OpenSim.Region.Framework.Scenes
}
}
// returns offset position relative to root prim of object when siting
public Vector3 OffsetPositionToSOGRoot
{
get
{
if (ParentPart != null)
return ParentPart.OffsetPosition + (m_pos * ParentPart.RotationOffset);
else
return m_pos;
}
}
public Quaternion OffsetRotationToSOGRoot
{
get
{
if (ParentPart != null)
return ParentPart.RotationOffset * Rotation;
else
return Rotation;
}
}
public Quaternion WorldRotation
{
get
{
if (ParentPart != null)
return ParentPart.GetWorldRotation() * Rotation;
else
return Rotation;
}
}
/// <summary>
/// Current velocity of the avatar.
/// </summary>

View File

@ -8914,6 +8914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// replies as SL wiki
LSL_List res = new LSL_List();
SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed
int idx = 0;
while (idx < rules.Length)
{
@ -8949,7 +8950,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break;
case (int)ScriptBaseClass.PRIM_ROTATION:
Quaternion rot = avatar.WorldRotation;
Quaternion rot = avatar.Rotation;
if (sitPart != null)
{
rot = sitPart.GetWorldRotation() * rot; // apply sit part world rotation
}
res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W));
break;
@ -9036,7 +9042,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return res;
face = (int)rules.GetLSLIntegerItem(idx++);
int fullbright;
if (face == ScriptBaseClass.ALL_SIDES)
{
for (face = 0; face < 21; face++)
@ -9110,18 +9115,30 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
res.Add(new LSL_Vector(0f,0f,0f));
res.Add(new LSL_Float(1.0f));
break;
case (int)ScriptBaseClass.PRIM_NAME:
res.Add(new LSL_String(avatar.Name));
break;
case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String(""));
break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
Quaternion lrot = avatar.OffsetRotationToSOGRoot;
Quaternion lrot = avatar.Rotation;
if (sitPart != null)
{
lrot = sitPart.RotationOffset * lrot; // apply sit part rotation offset
}
res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W));
break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL:
Vector3 lpos = avatar.OffsetPositionToSOGRoot;
Vector3 lpos = avatar.OffsetPosition; // pos relative to sit part
if (sitPart != null)
{
lpos = sitPart.OffsetPosition + (lpos * sitPart.RotationOffset); // make it relative to root prim
}
res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
break;
}