Fix avatar height management

viewer-2-initial-appearance
Melanie 2010-11-02 23:39:45 +00:00
parent 43ac44b028
commit d555c373d8
1 changed files with 11 additions and 24 deletions

View File

@ -171,9 +171,6 @@ namespace OpenSim.Region.Framework.Scenes
private float m_health = 100f;
// Default AV Height
private float m_avHeight = 127.0f;
protected RegionInfo m_regionInfo;
protected ulong crossingFromRegion;
@ -841,9 +838,10 @@ namespace OpenSim.Region.Framework.Scenes
}
float localAVHeight = 1.56f;
if (m_avHeight != 127.0f)
if (m_appearance != null)
{
localAVHeight = m_avHeight;
if (m_appearance.AvatarHeight > 0)
localAVHeight = m_appearance.AvatarHeight;
}
float posZLimit = 0;
@ -1066,10 +1064,9 @@ namespace OpenSim.Region.Framework.Scenes
/// </summary>
public void SetHeight(float height)
{
m_avHeight = height;
if (PhysicsActor != null && !IsChildAgent)
{
Vector3 SetSize = new Vector3(0.45f, 0.6f, m_avHeight);
Vector3 SetSize = new Vector3(0.45f, 0.6f, height);
PhysicsActor.Size = SetSize;
}
}
@ -1693,9 +1690,10 @@ namespace OpenSim.Region.Framework.Scenes
m_parentID = 0;
SendFullUpdateToAllClients();
m_requestedSitTargetID = 0;
if ((m_physicsActor != null) && (m_avHeight > 0))
if (m_physicsActor != null && m_appearance != null)
{
SetHeight(m_avHeight);
if (m_appearance.AvatarHeight > 0)
SetHeight(m_appearance.AvatarHeight);
}
}
@ -2585,7 +2583,7 @@ namespace OpenSim.Region.Framework.Scenes
cadu.ActiveGroupID = UUID.Zero.Guid;
cadu.AgentID = UUID.Guid;
cadu.alwaysrun = m_setAlwaysRun;
cadu.AVHeight = m_avHeight;
cadu.AVHeight = m_appearance.AvatarHeight;
Vector3 tempCameraCenter = m_CameraCenter;
cadu.cameraPosition = tempCameraCenter;
cadu.drawdistance = m_DrawDistance;
@ -2921,7 +2919,6 @@ namespace OpenSim.Region.Framework.Scenes
m_CameraCenter = cAgentData.Center + offset;
m_avHeight = cAgentData.Size.Z;
//SetHeight(cAgentData.AVHeight);
if ((cAgentData.Throttles != null) && cAgentData.Throttles.Length > 0)
@ -2946,8 +2943,6 @@ namespace OpenSim.Region.Framework.Scenes
cAgent.Position = AbsolutePosition;
cAgent.Velocity = m_velocity;
cAgent.Center = m_CameraCenter;
// Don't copy the size; it is inferred from apearance parameters
//cAgent.Size = new Vector3(0, 0, m_avHeight);
cAgent.AtAxis = m_CameraAtAxis;
cAgent.LeftAxis = m_CameraLeftAxis;
cAgent.UpAxis = m_CameraUpAxis;
@ -3065,7 +3060,6 @@ namespace OpenSim.Region.Framework.Scenes
m_pos = cAgent.Position;
m_velocity = cAgent.Velocity;
m_CameraCenter = cAgent.Center;
//m_avHeight = cAgent.Size.Z;
m_CameraAtAxis = cAgent.AtAxis;
m_CameraLeftAxis = cAgent.LeftAxis;
m_CameraUpAxis = cAgent.UpAxis;
@ -3198,16 +3192,9 @@ namespace OpenSim.Region.Framework.Scenes
Vector3 pVec = AbsolutePosition;
// Old bug where the height was in centimeters instead of meters
if (m_avHeight == 127.0f)
{
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec, new Vector3(0f, 0f, 1.56f),
isFlying);
}
else
{
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
new Vector3(0f, 0f, m_avHeight), isFlying);
}
m_physicsActor = scene.AddAvatar(Firstname + "." + Lastname, pVec,
new Vector3(0f, 0f, m_appearance.AvatarHeight), isFlying);
scene.AddPhysicsActorTaint(m_physicsActor);
//m_physicsActor.OnRequestTerseUpdate += SendTerseUpdateToAllClients;
m_physicsActor.OnCollisionUpdate += PhysicsCollisionUpdate;