Stop the avatar stalling on its first boarder cross when using the ODE plugin

When upgrading the previously child agent to a root, the code was setting the Size parameter on the ODECharacter PhysicsActor.
This in turn reset Velocity, which cause the border stall.
I'm fixing this by commenting out the Velocity = Vector3.Zero lines since they don't appear to play a useful purpose
remove-scene-viewer
Justin Clark-Casey (justincc) 2011-09-16 23:57:16 +01:00
parent adfe713b43
commit 6f542f73d4
2 changed files with 23 additions and 6 deletions

View File

@ -469,6 +469,10 @@ namespace OpenSim.Region.Framework.Scenes
if (actor != null) if (actor != null)
{ {
m_pos = actor.Position; m_pos = actor.Position;
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Set position {0} for {1} in {2} via getting AbsolutePosition!",
// m_pos, Name, Scene.RegionInfo.RegionName);
} }
else else
{ {
@ -544,8 +548,14 @@ namespace OpenSim.Region.Framework.Scenes
{ {
PhysicsActor actor = m_physicsActor; PhysicsActor actor = m_physicsActor;
if (actor != null) if (actor != null)
{
m_velocity = actor.Velocity; m_velocity = actor.Velocity;
// m_log.DebugFormat(
// "[SCENE PRESENCE]: Set velocity {0} for {1} in {2} via getting Velocity!",
// m_velocity, Name, Scene.RegionInfo.RegionName);
}
return m_velocity; return m_velocity;
} }
set set

View File

@ -464,10 +464,12 @@ namespace OpenSim.Region.Physics.OdePlugin
m_pidControllerActive = true; m_pidControllerActive = true;
Vector3 SetSize = value; Vector3 SetSize = value;
m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f;
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); // m_log.Info("[SIZE]: " + CAPSULE_LENGTH);
Velocity = Vector3.Zero; // 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).
// Velocity = Vector3.Zero;
_parent_scene.AddPhysicsActorTaint(this); _parent_scene.AddPhysicsActorTaint(this);
} }
@ -785,6 +787,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character"); m_log.Warn("[PHYSICS]: Got a NaN velocity from Scene in a Character");
} }
// m_log.DebugFormat("[PHYSICS]: Set target velocity of {0}", _target_velocity);
} }
} }
@ -1325,7 +1329,8 @@ namespace OpenSim.Region.Physics.OdePlugin
{ {
if (Shell != IntPtr.Zero && Body != IntPtr.Zero && Amotor != IntPtr.Zero) if (Shell != IntPtr.Zero && Body != IntPtr.Zero && Amotor != IntPtr.Zero)
{ {
// m_log.DebugFormat("[PHYSICS]: Changing capsule size");
m_pidControllerActive = true; m_pidControllerActive = true;
// no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate() // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate()
d.JointDestroy(Amotor); d.JointDestroy(Amotor);
@ -1336,7 +1341,10 @@ namespace OpenSim.Region.Physics.OdePlugin
d.GeomDestroy(Shell); d.GeomDestroy(Shell);
AvatarGeomAndBodyCreation(_position.X, _position.Y, AvatarGeomAndBodyCreation(_position.X, _position.Y,
_position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor);
Velocity = Vector3.Zero;
// As with Size, we reset velocity. However, this isn't strictly necessary since it doesn't
// appear to stall initial region crossings when done here. Being done for consistency.
// Velocity = Vector3.Zero;
_parent_scene.geom_name_map[Shell] = m_name; _parent_scene.geom_name_map[Shell] = m_name;
_parent_scene.actor_name_map[Shell] = (PhysicsActor)this; _parent_scene.actor_name_map[Shell] = (PhysicsActor)this;
@ -1361,7 +1369,6 @@ namespace OpenSim.Region.Physics.OdePlugin
_position.Z = m_taintPosition.Z; _position.Z = m_taintPosition.Z;
} }
} }
} }
internal void AddCollisionFrameTime(int p) internal void AddCollisionFrameTime(int p)