Moved auxiliar funtions of last commit from sop to lsl api since they are only used on one place each

avinationmerge
UbitUmarov 2012-06-12 02:20:47 +01:00
parent 24e8e5d818
commit 5fd6f678a4
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> /// <summary>
/// Current velocity of the avatar. /// Current velocity of the avatar.
/// </summary> /// </summary>

View File

@ -8914,6 +8914,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
// replies as SL wiki // replies as SL wiki
LSL_List res = new LSL_List(); LSL_List res = new LSL_List();
SceneObjectPart sitPart = avatar.ParentPart; // most likelly it will be needed
int idx = 0; int idx = 0;
while (idx < rules.Length) while (idx < rules.Length)
{ {
@ -8949,7 +8950,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
break; break;
case (int)ScriptBaseClass.PRIM_ROTATION: 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)); res.Add(new LSL_Rotation (rot.X, rot.Y, rot.Z, rot.W));
break; break;
@ -9036,7 +9042,6 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
return res; return res;
face = (int)rules.GetLSLIntegerItem(idx++); face = (int)rules.GetLSLIntegerItem(idx++);
int fullbright;
if (face == ScriptBaseClass.ALL_SIDES) if (face == ScriptBaseClass.ALL_SIDES)
{ {
for (face = 0; face < 21; face++) 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_Vector(0f,0f,0f));
res.Add(new LSL_Float(1.0f)); res.Add(new LSL_Float(1.0f));
break; break;
case (int)ScriptBaseClass.PRIM_NAME: case (int)ScriptBaseClass.PRIM_NAME:
res.Add(new LSL_String(avatar.Name)); res.Add(new LSL_String(avatar.Name));
break; break;
case (int)ScriptBaseClass.PRIM_DESC: case (int)ScriptBaseClass.PRIM_DESC:
res.Add(new LSL_String("")); res.Add(new LSL_String(""));
break; break;
case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
Quaternion lrot = avatar.OffsetRotationToSOGRoot; case (int)ScriptBaseClass.PRIM_ROT_LOCAL:
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)); res.Add(new LSL_Rotation(lrot.X, lrot.Y, lrot.Z, lrot.W));
break; break;
case (int)ScriptBaseClass.PRIM_POS_LOCAL: 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)); res.Add(new LSL_Vector(lpos.X,lpos.Y,lpos.Z));
break; break;
} }