From 308a0bc2e46d0a3ce805b0603392d50ca171b53d Mon Sep 17 00:00:00 2001 From: Justin Clarke Casey Date: Mon, 13 Oct 2008 20:56:56 +0000 Subject: * Apply http://opensimulator.org/mantis/view.php?id=2249 * Calculate an agents height in LLGetAgentSize() from apperance parameters rather than physics avatar numbers * Another good looking patch from idb - thanks! --- .../ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 428aeb6..7993d95 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -4636,6 +4636,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); } + /// + /// According to http://lslwiki.net/lslwiki/wakka.php?wakka=llGetAgentSize + /// only the height of avatars vary and that says:- + /// Width (x) and depth (y) are constant. (0.45m and 0.6m respectively). + /// public LSL_Vector llGetAgentSize(string id) { m_host.AddScriptLPS(1); @@ -4647,8 +4652,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api } else { - PhysicsVector size = avatar.PhysicsActor.Size; - agentSize = new LSL_Vector(size.X, size.Y, size.Z); + byte[] parms = avatar.Appearance.VisualParams; + // The values here were arrived at from experimentation with the sliders + // in edit appearance in SL to find the ones that affected the height and how + // much they affected it. + float avatarHeight = 1.23077f // Shortest possible avatar height + + 0.516945f * (float)parms[25] / 255.0f // Body length + + 0.072514f * (float)parms[120] / 255.0f // Head size + + 0.3836f * (float)parms[125] / 255.0f // Leg length + + 0.076f * (float)parms[148] / 255.0f; // Neck length + agentSize = new LSL_Vector(0.45, 0.6, avatarHeight); } return agentSize; } -- cgit v1.1