Some positioning fixes from AVN trunk
parent
b9e700b60d
commit
1b9ae3fb51
|
@ -1958,6 +1958,27 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return end;
|
return end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected LSL_Vector GetSetPosTarget(SceneObjectPart part, LSL_Vector targetPos, LSL_Vector fromPos)
|
||||||
|
{
|
||||||
|
if (part == null || part.ParentGroup == null || part.ParentGroup.IsDeleted)
|
||||||
|
return fromPos;
|
||||||
|
|
||||||
|
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
|
||||||
|
|
||||||
|
|
||||||
|
float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
|
||||||
|
bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
|
||||||
|
|
||||||
|
if (part.ParentGroup.RootPart == part)
|
||||||
|
{
|
||||||
|
if ((targetPos.z < ground) && disable_underground_movement && m_host.ParentGroup.AttachmentPoint == 0)
|
||||||
|
targetPos.z = ground;
|
||||||
|
}
|
||||||
|
LSL_Vector real_vec = SetPosAdjust(fromPos, targetPos);
|
||||||
|
|
||||||
|
return real_vec;
|
||||||
|
}
|
||||||
|
|
||||||
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
|
protected void SetPos(SceneObjectPart part, LSL_Vector targetPos)
|
||||||
{
|
{
|
||||||
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
|
// Capped movemment if distance > 10m (http://wiki.secondlife.com/wiki/LlSetPos)
|
||||||
|
@ -7043,6 +7064,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
{
|
{
|
||||||
int idx = 0;
|
int idx = 0;
|
||||||
|
|
||||||
|
bool positionChanged = false;
|
||||||
|
LSL_Vector currentPosition = GetPartLocalPos(part);
|
||||||
|
|
||||||
while (idx < rules.Length)
|
while (idx < rules.Length)
|
||||||
{
|
{
|
||||||
int code = rules.GetLSLIntegerItem(idx++);
|
int code = rules.GetLSLIntegerItem(idx++);
|
||||||
|
@ -7059,7 +7083,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
return;
|
return;
|
||||||
|
|
||||||
v=rules.GetVector3Item(idx++);
|
v=rules.GetVector3Item(idx++);
|
||||||
SetPos(part, v);
|
positionChanged = true;
|
||||||
|
currentPosition = GetSetPosTarget(part, v, currentPosition);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case (int)ScriptBaseClass.PRIM_SIZE:
|
case (int)ScriptBaseClass.PRIM_SIZE:
|
||||||
|
@ -7418,6 +7443,22 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (positionChanged)
|
||||||
|
{
|
||||||
|
if (part.ParentGroup.RootPart == part)
|
||||||
|
{
|
||||||
|
SceneObjectGroup parent = part.ParentGroup;
|
||||||
|
parent.UpdateGroupPosition(new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
part.OffsetPosition = new Vector3((float)currentPosition.x, (float)currentPosition.y, (float)currentPosition.z);
|
||||||
|
SceneObjectGroup parent = part.ParentGroup;
|
||||||
|
parent.HasGroupChanged = true;
|
||||||
|
parent.ScheduleGroupForTerseUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public LSL_String llStringToBase64(string str)
|
public LSL_String llStringToBase64(string str)
|
||||||
|
|
Loading…
Reference in New Issue