add some default size setting and checks

avinationmerge
UbitUmarov 2012-12-07 21:53:33 +00:00
parent 93bede4e6a
commit c73c2fb070
3 changed files with 28 additions and 4 deletions

View File

@ -40,10 +40,12 @@ namespace OpenSim.Framework
/// </summary> /// </summary>
public class AvatarAppearance public class AvatarAppearance
{ {
// SL box diferent to size
const float AVBOXAJUST = 0.2f; const float AVBOXAJUST = 0.2f;
// constrains for ubitode physics
const float AVBOXMINX = 0.2f; const float AVBOXMINX = 0.2f;
const float AVBOXMINY = 0.3f; 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); private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -60,7 +62,7 @@ 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 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 Vector3 m_avatarBoxSize = new Vector3(0.45f, 0.6f, 1.9f);
protected float m_avatarFeetOffset = 0; protected float m_avatarFeetOffset = 0;
protected float m_avatarAnimOffset = 0; protected float m_avatarAnimOffset = 0;
@ -157,6 +159,8 @@ namespace OpenSim.Framework
SetDefaultParams(); SetDefaultParams();
// SetHeight(); // SetHeight();
if(m_avatarHeight == 0)
SetSize(new Vector3(0.45f,0.6f,1.9f));
m_attachments = new Dictionary<int, List<AvatarAttachment>>(); m_attachments = new Dictionary<int, List<AvatarAttachment>>();
} }
@ -408,6 +412,20 @@ namespace OpenSim.Framework
public void SetSize(Vector3 avSize) 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_avatarSize = avSize;
m_avatarBoxSize = avSize; m_avatarBoxSize = avSize;
m_avatarBoxSize.Z += AVBOXAJUST; m_avatarBoxSize.Z += AVBOXAJUST;

View File

@ -3443,8 +3443,9 @@ namespace OpenSim.Region.Framework.Scenes
Name, Scene.RegionInfo.RegionName); Name, Scene.RegionInfo.RegionName);
} }
// if (Appearance.AvatarHeight == 0) if (Appearance.AvatarHeight == 0)
// Appearance.SetHeight(); // Appearance.SetHeight();
Appearance.SetSize(new Vector3(0.45f,0.6f,1.9f));
PhysicsScene scene = m_scene.PhysicsScene; PhysicsScene scene = m_scene.PhysicsScene;

View File

@ -201,8 +201,13 @@ namespace OpenSim.Services.Interfaces
appearance.Serial = Int32.Parse(Data["Serial"]); appearance.Serial = Int32.Parse(Data["Serial"]);
if (Data.ContainsKey("AvatarHeight")) 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"]); // appearance.AvatarHeight = float.Parse(Data["AvatarHeight"]);
}
// Legacy Wearables // Legacy Wearables
if (Data.ContainsKey("BodyItem")) if (Data.ContainsKey("BodyItem"))