From 0ee7a5ee81437f7fb81814b1694c00cb5a206bda Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 15 Jul 2011 23:36:32 +0100 Subject: If object is an attachment, make llGetVel() return the avatar's speed rather than the object's own zero speed. As per http://opensimulator.org/mantis/view.php?id=5575 --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'OpenSim/Region/ScriptEngine') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index c8bce60..7759b0a 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -2214,7 +2214,20 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api public LSL_Vector llGetVel() { m_host.AddScriptLPS(1); - return new LSL_Vector(m_host.Velocity.X, m_host.Velocity.Y, m_host.Velocity.Z); + + Vector3 vel; + + if (m_host.IsAttachment) + { + ScenePresence avatar = m_host.ParentGroup.Scene.GetScenePresence(m_host.AttachedAvatar); + vel = avatar.Velocity; + } + else + { + vel = m_host.Velocity; + } + + return new LSL_Vector(vel.X, vel.Y, vel.Z); } public LSL_Vector llGetAccel() @@ -10021,8 +10034,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api break; } } + return ret; } + SceneObjectPart obj = World.GetSceneObjectPart(key); if (obj != null) { -- cgit v1.1