Fix avatar height, removes the hip offset hack

Author: Mana Janus <mana@mjm-labs.com>
remove-scene-viewer
nebadon 2011-11-05 02:56:52 -07:00
parent 4797ed6edd
commit e182cc198d
2 changed files with 12 additions and 27 deletions

View File

@ -53,7 +53,6 @@ namespace OpenSim.Framework
protected AvatarWearable[] m_wearables; protected AvatarWearable[] m_wearables;
protected Dictionary<int, List<AvatarAttachment>> m_attachments; protected Dictionary<int, List<AvatarAttachment>> m_attachments;
protected float m_avatarHeight = 0; protected float m_avatarHeight = 0;
protected float m_hipOffset = 0;
public virtual int Serial public virtual int Serial
{ {
@ -89,11 +88,6 @@ namespace OpenSim.Framework
set { m_avatarHeight = value; } set { m_avatarHeight = value; }
} }
public virtual float HipOffset
{
get { return m_hipOffset; }
}
public AvatarAppearance() public AvatarAppearance()
{ {
// m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance"); // m_log.WarnFormat("[AVATAR APPEARANCE]: create empty appearance");
@ -184,7 +178,6 @@ namespace OpenSim.Framework
m_visualparams = (byte[])appearance.VisualParams.Clone(); m_visualparams = (byte[])appearance.VisualParams.Clone();
m_avatarHeight = appearance.m_avatarHeight; m_avatarHeight = appearance.m_avatarHeight;
m_hipOffset = appearance.m_hipOffset;
// Copy the attachment, force append mode since that ensures consistency // Copy the attachment, force append mode since that ensures consistency
m_attachments = new Dictionary<int, List<AvatarAttachment>>(); m_attachments = new Dictionary<int, List<AvatarAttachment>>();
@ -332,20 +325,18 @@ namespace OpenSim.Framework
public virtual void SetHeight() public virtual void SetHeight()
{ {
m_avatarHeight = 1.23077f // Shortest possible avatar height // Start with shortest possible female avatar height
+ 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height m_avatarHeight = 1.14597f;
+ 0.072514f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f // Head size // Add offset for male avatars
+ 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length if (m_visualparams[(int)VPElement.SHAPE_MALE] != 0)
+ 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height m_avatarHeight += 0.0848f;
+ 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height // Add offsets for visual params
+ 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f; // Neck length m_avatarHeight += 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f
+ 0.08117f * (float)m_visualparams[(int)VPElement.SHAPE_HEAD_SIZE] / 255.0f
m_hipOffset = (((1.23077f // Half of avatar + 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f
+ 0.516945f * (float)m_visualparams[(int)VPElement.SHAPE_HEIGHT] / 255.0f // Body height + 0.07f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f
+ 0.3836f * (float)m_visualparams[(int)VPElement.SHAPE_LEG_LENGTH] / 255.0f // Leg length + 0.08f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f
+ 0.08f * (float)m_visualparams[(int)VPElement.SHOES_PLATFORM_HEIGHT] / 255.0f // Shoe platform height + 0.076f * (float)m_visualparams[(int)VPElement.SHAPE_NECK_LENGTH] / 255.0f;
+ 0.07f * (float)m_visualparams[(int)VPElement.SHOES_HEEL_HEIGHT] / 255.0f // Shoe heel height
) / 2) - m_avatarHeight / 2) * 0.31f - 0.0425f;
} }
public virtual void SetWearable(int wearableId, AvatarWearable wearable) public virtual void SetWearable(int wearableId, AvatarWearable wearable)
@ -578,7 +569,6 @@ namespace OpenSim.Framework
data["serial"] = OSD.FromInteger(m_serial); data["serial"] = OSD.FromInteger(m_serial);
data["height"] = OSD.FromReal(m_avatarHeight); data["height"] = OSD.FromReal(m_avatarHeight);
data["hipoffset"] = OSD.FromReal(m_hipOffset);
// Wearables // Wearables
OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES); OSDArray wears = new OSDArray(AvatarWearable.MAX_WEARABLES);
@ -621,8 +611,6 @@ namespace OpenSim.Framework
m_serial = data["serial"].AsInteger(); m_serial = data["serial"].AsInteger();
if ((data != null) && (data["height"] != null)) if ((data != null) && (data["height"] != null))
m_avatarHeight = (float)data["height"].AsReal(); m_avatarHeight = (float)data["height"].AsReal();
if ((data != null) && (data["hipoffset"] != null))
m_hipOffset = (float)data["hipoffset"].AsReal();
try try
{ {

View File

@ -2445,9 +2445,6 @@ namespace OpenSim.Region.Framework.Scenes
// server. // server.
if (remoteClient.IsActive) if (remoteClient.IsActive)
{ {
Vector3 pos = m_pos;
pos.Z += Appearance.HipOffset;
//m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity); //m_log.DebugFormat("[SCENE PRESENCE]: " + Name + " sending TerseUpdate to " + remoteClient.Name + " : Pos={0} Rot={1} Vel={2}", m_pos, Rotation, m_velocity);
remoteClient.SendEntityUpdate( remoteClient.SendEntityUpdate(