diff options
author | idb | 2008-12-01 00:49:36 +0000 |
---|---|---|
committer | idb | 2008-12-01 00:49:36 +0000 |
commit | 098f16fe3192ef17e7c749a70ea0607a22ae55fa (patch) | |
tree | f107a86180f4ebaf7103b466f05c2faeb119cb24 /OpenSim/Region/ScriptEngine | |
parent | Mantis #2584 (again) (diff) | |
download | opensim-SC_OLD-098f16fe3192ef17e7c749a70ea0607a22ae55fa.zip opensim-SC_OLD-098f16fe3192ef17e7c749a70ea0607a22ae55fa.tar.gz opensim-SC_OLD-098f16fe3192ef17e7c749a70ea0607a22ae55fa.tar.bz2 opensim-SC_OLD-098f16fe3192ef17e7c749a70ea0607a22ae55fa.tar.xz |
Remove duplicated avatar height calculation in lsl functions.
Use height calculation in Basic Physics and Physics of Simplicity so that avatars larger than the default walk with straight legs and shorter walk on the ground.
Diffstat (limited to 'OpenSim/Region/ScriptEngine')
-rw-r--r-- | OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 17dca98..90b2583 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -5040,27 +5040,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5040 | } | 5040 | } |
5041 | else | 5041 | else |
5042 | { | 5042 | { |
5043 | agentSize = new LSL_Vector(0.45, 0.6, calculateAgentHeight(avatar)); | 5043 | agentSize = new LSL_Vector(0.45, 0.6, avatar.Appearance.AvatarHeight); |
5044 | } | 5044 | } |
5045 | return agentSize; | 5045 | return agentSize; |
5046 | } | 5046 | } |
5047 | 5047 | ||
5048 | private float calculateAgentHeight(ScenePresence avatar) | ||
5049 | { | ||
5050 | byte[] parms = avatar.Appearance.VisualParams; | ||
5051 | // The values here were arrived at from experimentation with the sliders | ||
5052 | // in edit appearance in SL to find the ones that affected the height and how | ||
5053 | // much they affected it. | ||
5054 | float avatarHeight = 1.23077f // Shortest possible avatar height | ||
5055 | + 0.516945f * (float)parms[25] / 255.0f // Body height | ||
5056 | + 0.072514f * (float)parms[120] / 255.0f // Head size | ||
5057 | + 0.3836f * (float)parms[125] / 255.0f // Leg length | ||
5058 | + 0.08f * (float)parms[77] / 255.0f // Shoe heel height | ||
5059 | + 0.07f * (float)parms[78] / 255.0f // Shoe platform height | ||
5060 | + 0.076f * (float)parms[148] / 255.0f; // Neck length | ||
5061 | return avatarHeight; | ||
5062 | } | ||
5063 | |||
5064 | public LSL_Integer llSameGroup(string agent) | 5048 | public LSL_Integer llSameGroup(string agent) |
5065 | { | 5049 | { |
5066 | m_host.AddScriptLPS(1); | 5050 | m_host.AddScriptLPS(1); |
@@ -6600,14 +6584,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6600 | if (presence.Animations.DefaultAnimation.AnimID == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) | 6584 | if (presence.Animations.DefaultAnimation.AnimID == AnimationSet.Animations.AnimsUUID["SIT_GROUND_CONSTRAINED"]) |
6601 | { | 6585 | { |
6602 | // This is for ground sitting avatars | 6586 | // This is for ground sitting avatars |
6603 | float height = calculateAgentHeight(presence) / 2.66666667f; | 6587 | float height = presence.Appearance.AvatarHeight / 2.66666667f; |
6604 | lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f); | 6588 | lower = new LSL_Vector(-0.3375f, -0.45f, height * -1.0f); |
6605 | upper = new LSL_Vector(0.3375f, 0.45f, 0.0f); | 6589 | upper = new LSL_Vector(0.3375f, 0.45f, 0.0f); |
6606 | } | 6590 | } |
6607 | else | 6591 | else |
6608 | { | 6592 | { |
6609 | // This is for standing/flying avatars | 6593 | // This is for standing/flying avatars |
6610 | float height = calculateAgentHeight(presence) / 2.0f; | 6594 | float height = presence.Appearance.AvatarHeight / 2.0f; |
6611 | lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f); | 6595 | lower = new LSL_Vector(-0.225f, -0.3f, height * -1.0f); |
6612 | upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f); | 6596 | upper = new LSL_Vector(0.225f, 0.3f, height + 0.05f); |
6613 | } | 6597 | } |