From c79a11cbd1eeb8359ad08178830c94cc0d52f877 Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Fri, 14 Nov 2008 03:32:20 +0000 Subject: Lots of experimentation yielded a fair approximation of a hip offset from the physical center of an avatar, for display purposes. This should keep the avatar feet above ground visually in most cases. Tweaked for both height extremes and various leg lengths. Improvements welcome --- OpenSim/Framework/AvatarAppearance.cs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'OpenSim/Framework/AvatarAppearance.cs') diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index f2ceb20..f549461 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -227,6 +227,7 @@ namespace OpenSim.Framework } protected float m_avatarHeight = 0; + protected float m_hipOffset = 0; public virtual float AvatarHeight { @@ -234,6 +235,11 @@ namespace OpenSim.Framework set { m_avatarHeight = value; } } + public virtual float HipOffset + { + get { return m_hipOffset; } + } + public AvatarAppearance() { m_wearables = new AvatarWearable[MAX_WEARABLES]; @@ -275,7 +281,12 @@ namespace OpenSim.Framework + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length - + m_hipOffset = (0.615385f // Half of avatar + + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height + + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height + + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length + - m_avatarHeight / 2) * 0.3f - 0.04f; + System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset); } public virtual void SetWearable(int wearableId, AvatarWearable wearable) -- cgit v1.1