aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework
diff options
context:
space:
mode:
authornebadon2011-11-05 02:56:52 -0700
committernebadon2011-11-05 02:56:52 -0700
commite182cc198d3b0151b2a891f6470e664f77e42d79 (patch)
treea9b7c4c7f95f11c87a981c0e2fd5f6cc14a65754 /OpenSim/Framework
parentMultiple lines in welcome message use '\n' in the welcome message to (diff)
downloadopensim-SC_OLD-e182cc198d3b0151b2a891f6470e664f77e42d79.zip
opensim-SC_OLD-e182cc198d3b0151b2a891f6470e664f77e42d79.tar.gz
opensim-SC_OLD-e182cc198d3b0151b2a891f6470e664f77e42d79.tar.bz2
opensim-SC_OLD-e182cc198d3b0151b2a891f6470e664f77e42d79.tar.xz
Fix avatar height, removes the hip offset hack
Author: Mana Janus <mana@mjm-labs.com>
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs36
1 files changed, 12 insertions, 24 deletions
diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs
index 72b580b..6c2a954 100644
--- a/OpenSim/Framework/AvatarAppearance.cs
+++ b/OpenSim/Framework/AvatarAppearance.cs
@@ -53,7 +53,6 @@ namespace OpenSim.Framework
53 protected AvatarWearable[] m_wearables; 53 protected AvatarWearable[] m_wearables;
54 protected Dictionary<int, List<AvatarAttachment>> m_attachments; 54 protected Dictionary<int, List<AvatarAttachment>> m_attachments;
55 protected float m_avatarHeight = 0; 55 protected float m_avatarHeight = 0;
56 protected float m_hipOffset = 0;
57 56
58 public virtual int Serial 57 public virtual int Serial
59 { 58 {
@@ -89,11 +88,6 @@ namespace OpenSim.Framework
89 set { m_avatarHeight = value; } 88 set { m_avatarHeight = value; }
90 } 89 }
91 90
92 public virtual float HipOffset
93 {
94 get { return m_hipOffset; }
95 }
96
97 public AvatarAppearance() 91 public AvatarAppearance()
98 { 92 {
99// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); 93// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
@@ -184,7 +178,6 @@ namespace OpenSim.Framework
184 m_visualparams = (byte[])appearance.VisualParams.Clone(); 178 m_visualparams = (byte[])appearance.VisualParams.Clone();
185 179
186 m_avatarHeight = appearance.m_avatarHeight; 180 m_avatarHeight = appearance.m_avatarHeight;
187 m_hipOffset = appearance.m_hipOffset;
188 181
189 // Copy the attachment, force append mode since that ensures consistency 182 // Copy the attachment, force append mode since that ensures consistency
190 m_attachments = new Dictionary<int, List<AvatarAttachment>>(); 183 m_attachments = new Dictionary<int, List<AvatarAttachment>>();
@@ -332,20 +325,18 @@ namespace OpenSim.Framework
332 325
333 public virtual void SetHeight() 326 public virtual void SetHeight()
334 { 327 {
335 m_avatarHeight = 1.23077f // Shortest possible avatar height 328 // Start with shortest possible female avatar height
336 + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height 329 m_avatarHeight = 1.14597f;
337 + 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size 330 // Add offset for male avatars
338 + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length 331 if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0)
339 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height 332 m_avatarHeight += 0.0848f;
340 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height 333 // Add offsets for visual params
341 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length 334 m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f
342 335 + 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f
343 m_hipOffset = (((1.23077f // Half of avatar 336 + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f
344 + 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height 337 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f
345 + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length 338 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f
346 + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height 339 + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f;
347 + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height
348 ) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f;
349 } 340 }
350 341
351 public virtual void SetWearable(int wearableId, AvatarWearable wearable) 342 public virtual void SetWearable(int wearableId, AvatarWearable wearable)
@@ -578,7 +569,6 @@ namespace OpenSim.Framework
578 569
579 data["serial"] = OSD.FromInteger(m_serial); 570 data["serial"] = OSD.FromInteger(m_serial);
580 data["height"] = OSD.FromReal(m_avatarHeight); 571 data["height"] = OSD.FromReal(m_avatarHeight);
581 data["hipoffset"] = OSD.FromReal(m_hipOffset);
582 572
583 // Wearables 573 // Wearables
584 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); 574 OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES);
@@ -621,8 +611,6 @@ namespace OpenSim.Framework
621 m_serial = data["serial"].AsInteger(); 611 m_serial = data["serial"].AsInteger();
622 if ((data != null) && (data["height"] != null)) 612 if ((data != null) && (data["height"] != null))
623 m_avatarHeight = (float)data["height"].AsReal(); 613 m_avatarHeight = (float)data["height"].AsReal();
624 if ((data != null) && (data["hipoffset"] != null))
625 m_hipOffset = (float)data["hipoffset"].AsReal();
626 614
627 try 615 try
628 { 616 {