aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorMelanie Thielker2008-11-14 03:32:20 +0000
committerMelanie Thielker2008-11-14 03:32:20 +0000
commitc79a11cbd1eeb8359ad08178830c94cc0d52f877 (patch)
tree7ed6329eb68c2077c9b74f0b2cb1b499ed4feaa9 /OpenSim
parentmake inventory item listing more robust. It turns out that a bad item (diff)
downloadopensim-SC_OLD-c79a11cbd1eeb8359ad08178830c94cc0d52f877.zip
opensim-SC_OLD-c79a11cbd1eeb8359ad08178830c94cc0d52f877.tar.gz
opensim-SC_OLD-c79a11cbd1eeb8359ad08178830c94cc0d52f877.tar.bz2
opensim-SC_OLD-c79a11cbd1eeb8359ad08178830c94cc0d52f877.tar.xz
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
Diffstat (limited to 'OpenSim')
-rw-r--r--OpenSim/Framework/AvatarAppearance.cs13
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs9
2 files changed, 20 insertions, 2 deletions
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
227 } 227 }
228 228
229 protected float m_avatarHeight = 0; 229 protected float m_avatarHeight = 0;
230 protected float m_hipOffset = 0;
230 231
231 public virtual float AvatarHeight 232 public virtual float AvatarHeight
232 { 233 {
@@ -234,6 +235,11 @@ namespace OpenSim.Framework
234 set { m_avatarHeight = value; } 235 set { m_avatarHeight = value; }
235 } 236 }
236 237
238 public virtual float HipOffset
239 {
240 get { return m_hipOffset; }
241 }
242
237 public AvatarAppearance() 243 public AvatarAppearance()
238 { 244 {
239 m_wearables = new AvatarWearable[MAX_WEARABLES]; 245 m_wearables = new AvatarWearable[MAX_WEARABLES];
@@ -275,7 +281,12 @@ namespace OpenSim.Framework
275 + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height 281 + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height
276 + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height 282 + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
277 + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length 283 + 0.076f * (float)m_visualparams[148] / 255.0f; // Neck length
278 284 m_hipOffset = (0.615385f // Half of avatar
285 + 0.08f * (float)m_visualparams[77] / 255.0f // Shoe heel height
286 + 0.07f * (float)m_visualparams[78] / 255.0f // Shoe platform height
287 + 0.3836f * (float)m_visualparams[125] / 255.0f // Leg length
288 - m_avatarHeight / 2) * 0.3f - 0.04f;
289 System.Console.WriteLine("Height {0} Hip offset {1}", m_avatarHeight, m_hipOffset);
279 } 290 }
280 291
281 public virtual void SetWearable(int wearableId, AvatarWearable wearable) 292 public virtual void SetWearable(int wearableId, AvatarWearable wearable)
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index af17fac..c91027c 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -759,7 +759,7 @@ namespace OpenSim.Region.Environment.Scenes
759 } 759 }
760 760
761 float posZLimit = (float)m_scene.GetLandHeight((int)pos.X, (int)pos.Y); 761 float posZLimit = (float)m_scene.GetLandHeight((int)pos.X, (int)pos.Y);
762 float newPosZ = posZLimit + localAVHeight; 762 float newPosZ = posZLimit + localAVHeight / 2;
763 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ))) 763 if (posZLimit >= (pos.Z - (localAVHeight / 2)) && !(Single.IsInfinity(newPosZ) || Single.IsNaN(newPosZ)))
764 { 764 {
765 pos.Z = newPosZ; 765 pos.Z = newPosZ;
@@ -1752,6 +1752,7 @@ namespace OpenSim.Region.Environment.Scenes
1752 Vector3 pos = m_pos; 1752 Vector3 pos = m_pos;
1753 Vector3 vel = Velocity; 1753 Vector3 vel = Velocity;
1754 Quaternion rot = m_bodyRot; 1754 Quaternion rot = m_bodyRot;
1755 pos.Z -= m_appearance.HipOffset;
1755 remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z), 1756 remoteClient.SendAvatarTerseUpdate(m_regionHandle, (ushort)(m_scene.TimeDilation * (float)ushort.MaxValue), LocalId, new Vector3(pos.X, pos.Y, pos.Z),
1756 new Vector3(vel.X, vel.Y, vel.Z), rot); 1757 new Vector3(vel.X, vel.Y, vel.Z), rot);
1757 1758
@@ -1835,6 +1836,9 @@ namespace OpenSim.Region.Environment.Scenes
1835 // Note: because Quaternion is a struct, it can't be null 1836 // Note: because Quaternion is a struct, it can't be null
1836 Quaternion rot = m_bodyRot; 1837 Quaternion rot = m_bodyRot;
1837 1838
1839 Vector3 pos = m_pos;
1840 pos.Z -= m_appearance.HipOffset;
1841
1838 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, 1842 remoteAvatar.m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid,
1839 LocalId, m_pos, m_appearance.Texture.ToBytes(), 1843 LocalId, m_pos, m_appearance.Texture.ToBytes(),
1840 m_parentID, rot); 1844 m_parentID, rot);
@@ -1900,6 +1904,9 @@ namespace OpenSim.Region.Environment.Scenes
1900 // Note: because Quaternion is a struct, it can't be null 1904 // Note: because Quaternion is a struct, it can't be null
1901 Quaternion rot = m_bodyRot; 1905 Quaternion rot = m_bodyRot;
1902 1906
1907 Vector3 pos = m_pos;
1908 pos.Z -= m_appearance.HipOffset;
1909
1903 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId, 1910 m_controllingClient.SendAvatarData(m_regionInfo.RegionHandle, m_firstname, m_lastname, m_grouptitle, m_uuid, LocalId,
1904 m_pos, m_appearance.Texture.ToBytes(), m_parentID, rot); 1911 m_pos, m_appearance.Texture.ToBytes(), m_parentID, rot);
1905 1912