From c73c2fb0707ee4dc78a354d932293f3e7e83ac50 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 7 Dec 2012 21:53:33 +0000 Subject: add some default size setting and checks --- OpenSim/Framework/AvatarAppearance.cs | 22 ++++++++++++++++++++-- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 3 ++- OpenSim/Services/Interfaces/IAvatarService.cs | 7 ++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/OpenSim/Framework/AvatarAppearance.cs b/OpenSim/Framework/AvatarAppearance.cs index b01b8da..2183fb6 100644 --- a/OpenSim/Framework/AvatarAppearance.cs +++ b/OpenSim/Framework/AvatarAppearance.cs @@ -40,10 +40,12 @@ namespace OpenSim.Framework /// public class AvatarAppearance { + // SL box diferent to size const float AVBOXAJUST = 0.2f; + // constrains for ubitode physics const float AVBOXMINX = 0.2f; const float AVBOXMINY = 0.3f; - const float AVBOXMINZ = 0.5f; + const float AVBOXMINZ = 1.2f; private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); @@ -60,7 +62,7 @@ namespace OpenSim.Framework protected AvatarWearable[] m_wearables; protected Dictionary> m_attachments; protected float m_avatarHeight = 0; - protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); + protected Vector3 m_avatarSize = new Vector3(0.45f, 0.6f, 1.9f); // sl Z cloud value protected Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f); protected float m_avatarFeetOffset = 0; protected float m_avatarAnimOffset = 0; @@ -157,6 +159,8 @@ namespace OpenSim.Framework SetDefaultParams(); // SetHeight(); + if(m_avatarHeight == 0) + SetSize(new Vector3(0.45f,0.6f,1.9f)); m_attachments = new Dictionary>(); } @@ -408,6 +412,20 @@ namespace OpenSim.Framework public void SetSize(Vector3 avSize) { + if (avSize.X > 32f) + avSize.X = 32f; + else if (avSize.X < 0.1f) + avSize.X = 0.1f; + + if (avSize.Y > 32f) + avSize.Y = 32f; + else if (avSize.Y < 0.1f) + avSize.Y = 0.1f; + if (avSize.Z > 32f) + avSize.Z = 32f; + else if (avSize.Z < 0.1f) + avSize.Z = 0.1f; + m_avatarSize = avSize; m_avatarBoxSize = avSize; m_avatarBoxSize.Z += AVBOXAJUST; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 9dfccca..9ada5bb 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -3443,8 +3443,9 @@ namespace OpenSim.Region.Framework.Scenes Name, Scene.RegionInfo.RegionName); } -// if (Appearance.AvatarHeight == 0) + if (Appearance.AvatarHeight == 0) // Appearance.SetHeight(); + Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f)); PhysicsScene scene = m_scene.PhysicsScene; diff --git a/OpenSim/Services/Interfaces/IAvatarService.cs b/OpenSim/Services/Interfaces/IAvatarService.cs index 260e1c6..c0130f1 100644 --- a/OpenSim/Services/Interfaces/IAvatarService.cs +++ b/OpenSim/Services/Interfaces/IAvatarService.cs @@ -201,8 +201,13 @@ namespace OpenSim.Services.Interfaces appearance.Serial = Int32.Parse(Data["Serial"]); if (Data.ContainsKey("AvatarHeight")) - appearance.SetSize(new Vector3(0.45f, 0.6f, float.Parse(Data["AvatarHeight"]))); + { + float h = float.Parse(Data["AvatarHeight"]); + if( h == 0f) + h = 1.9f; + appearance.SetSize(new Vector3(0.45f, 0.6f, h )); // appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]); + } // Legacy Wearables if (Data.ContainsKey("BodyItem")) -- cgit v1.1