Stop having to call SetHeight again in ScenePresence.AddToPhysicalScene() when we've already passed size information to the avatar at PhysicsScene.AddAvatar()
Eliminate some copypasta for height setting in OdeCharacteriar_mods
parent
99570d8ebb
commit
c0ba99e5ad
|
@ -1149,13 +1149,11 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Sets avatar height in the physics plugin
|
/// Sets avatar height in the physics plugin
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="height">New height of avatar</param>
|
||||||
public void SetHeight(float height)
|
public void SetHeight(float height)
|
||||||
{
|
{
|
||||||
if (PhysicsActor != null && !IsChildAgent)
|
if (PhysicsActor != null && !IsChildAgent)
|
||||||
{
|
PhysicsActor.Size = new Vector3(0.45f, 0.6f, height);
|
||||||
Vector3 SetSize = new Vector3(0.45f, 0.6f, height);
|
|
||||||
PhysicsActor.Size = SetSize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -3273,8 +3271,6 @@ namespace OpenSim.Region.Framework.Scenes
|
||||||
PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
|
PhysicsActor.OnOutOfBounds += OutOfBoundsCall; // Called for PhysicsActors when there's something wrong
|
||||||
PhysicsActor.SubscribeEvents(500);
|
PhysicsActor.SubscribeEvents(500);
|
||||||
PhysicsActor.LocalID = LocalId;
|
PhysicsActor.LocalID = LocalId;
|
||||||
|
|
||||||
SetHeight(Appearance.AvatarHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OutOfBoundsCall(Vector3 pos)
|
private void OutOfBoundsCall(Vector3 pos)
|
||||||
|
|
|
@ -44,8 +44,9 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
private bool flying;
|
private bool flying;
|
||||||
private bool iscolliding;
|
private bool iscolliding;
|
||||||
|
|
||||||
public BasicActor()
|
public BasicActor(Vector3 size)
|
||||||
{
|
{
|
||||||
|
Size = size;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override int PhysicsActorType
|
public override int PhysicsActorType
|
||||||
|
|
|
@ -56,7 +56,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
|
||||||
}
|
}
|
||||||
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
public override PhysicsActor AddAvatar(string avName, Vector3 position, Vector3 size, bool isFlying)
|
||||||
{
|
{
|
||||||
BasicActor act = new BasicActor();
|
BasicActor act = new BasicActor(size);
|
||||||
act.Position = position;
|
act.Position = position;
|
||||||
act.Flying = isFlying;
|
act.Flying = isFlying;
|
||||||
_actors.Add(act);
|
_actors.Add(act);
|
||||||
|
|
|
@ -199,9 +199,11 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
{
|
{
|
||||||
m_colliderarr[i] = false;
|
m_colliderarr[i] = false;
|
||||||
}
|
}
|
||||||
CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
|
||||||
//m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH.ToString());
|
// We can set taint and actual to be the same here, since the entire character will be set up when the
|
||||||
m_tainted_CAPSULE_LENGTH = CAPSULE_LENGTH;
|
// m_tainted_isPhysical is processed.
|
||||||
|
SetTaintedCapsuleLength(size);
|
||||||
|
CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
|
||||||
|
|
||||||
m_isPhysical = false; // current status: no ODE information exists
|
m_isPhysical = false; // current status: no ODE information exists
|
||||||
m_tainted_isPhysical = true; // new tainted status: need to create ODE information
|
m_tainted_isPhysical = true; // new tainted status: need to create ODE information
|
||||||
|
@ -457,13 +459,7 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
get { return new Vector3(CAPSULE_RADIUS * 2, CAPSULE_RADIUS * 2, CAPSULE_LENGTH); }
|
||||||
set
|
set
|
||||||
{
|
{
|
||||||
if (value.IsFinite())
|
SetTaintedCapsuleLength(value);
|
||||||
{
|
|
||||||
m_pidControllerActive = true;
|
|
||||||
|
|
||||||
Vector3 SetSize = value;
|
|
||||||
m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
|
||||||
// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
|
|
||||||
|
|
||||||
// If we reset velocity here, then an avatar stalls when it crosses a border for the first time
|
// If we reset velocity here, then an avatar stalls when it crosses a border for the first time
|
||||||
// (as the height of the new root agent is set).
|
// (as the height of the new root agent is set).
|
||||||
|
@ -471,10 +467,20 @@ namespace OpenSim.Region.Physics.OdePlugin
|
||||||
|
|
||||||
_parent_scene.AddPhysicsActorTaint(this);
|
_parent_scene.AddPhysicsActorTaint(this);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetTaintedCapsuleLength(Vector3 size)
|
||||||
|
{
|
||||||
|
if (size.IsFinite())
|
||||||
|
{
|
||||||
|
m_pidControllerActive = true;
|
||||||
|
|
||||||
|
m_tainted_CAPSULE_LENGTH = (size.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
|
||||||
|
// m_log.Info("[ODE CHARACTER]: " + CAPSULE_LENGTH);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size from Scene on {0}", Name);
|
m_log.WarnFormat("[ODE CHARACTER]: Got a NaN Size for {0} in {1}", Name, _parent_scene.Name);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue