Moved auxiliar funtions of last commit from sop to lsl api since they are only used on one place each
parent
24e8e5d818
commit
5fd6f678a4
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue