Fixes: llSetLinkPrimitiveParams - PRIM_POSITION is not relative to root, causes unexpected movement of child prims

Signed-off-by: Melanie <melanie@t-data.com>
0.7.0.2-release
unknown 2010-08-06 12:37:34 -04:00 committed by Diva Canto
parent 8b7e006ed0
commit de0445c8ea
1 changed files with 14 additions and 8 deletions

View File

@ -1919,7 +1919,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
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)
LSL_Vector currentPos = llGetLocalPos(); LSL_Vector currentPos = GetPartLocalPos((part);
float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y); float ground = World.GetGroundHeight((float)targetPos.x, (float)targetPos.y);
bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true); bool disable_underground_movement = m_ScriptEngine.Config.GetBoolean("DisableUndergroundMovement", true);
@ -1952,17 +1952,23 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
public LSL_Vector llGetLocalPos() public LSL_Vector llGetLocalPos()
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if (m_host.ParentID != 0) return GetPartLocalPos(m_host);
}
protected LSL_Vector GetPartLocalPos(SceneObjectPart part)
{
m_host.AddScriptLPS(1);
if (part.ParentID != 0)
{ {
return new LSL_Vector(m_host.OffsetPosition.X, return new LSL_Vector(part.OffsetPosition.X,
m_host.OffsetPosition.Y, part.OffsetPosition.Y,
m_host.OffsetPosition.Z); part.OffsetPosition.Z);
} }
else else
{ {
return new LSL_Vector(m_host.AbsolutePosition.X, return new LSL_Vector(part.AbsolutePosition.X,
m_host.AbsolutePosition.Y, part.AbsolutePosition.Y,
m_host.AbsolutePosition.Z); part.AbsolutePosition.Z);
} }
} }