From 6f542f73d4aacc0b92c2ebcff84b4ce2c8d9433b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Fri, 16 Sep 2011 23:57:16 +0100 Subject: 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 --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 0a0d13f..4cc8c59 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -464,10 +464,12 @@ namespace OpenSim.Region.Physics.OdePlugin m_pidControllerActive = true; Vector3 SetSize = value; - m_tainted_CAPSULE_LENGTH = (SetSize.Z*1.15f) - CAPSULE_RADIUS*2.0f; - //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); + m_tainted_CAPSULE_LENGTH = (SetSize.Z * 1.15f) - CAPSULE_RADIUS * 2.0f; +// 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); } @@ -785,6 +787,8 @@ namespace OpenSim.Region.Physics.OdePlugin { 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) { - +// m_log.DebugFormat("[PHYSICS]: Changing capsule size"); + m_pidControllerActive = true; // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate() d.JointDestroy(Amotor); @@ -1336,7 +1341,10 @@ namespace OpenSim.Region.Physics.OdePlugin d.GeomDestroy(Shell); AvatarGeomAndBodyCreation(_position.X, _position.Y, _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.actor_name_map[Shell] = (PhysicsActor)this; @@ -1361,7 +1369,6 @@ namespace OpenSim.Region.Physics.OdePlugin _position.Z = m_taintPosition.Z; } } - } internal void AddCollisionFrameTime(int p) -- cgit v1.1 From 1e798136c3458b8255fcb6341713bf9dbb689f4b Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Sat, 17 Sep 2011 01:33:55 +0100 Subject: adjust some whitespace to trigger another build, to check the last failure was just a glitch --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'OpenSim/Region/Physics/OdePlugin') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 924d7c2..ac92b8b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1526,6 +1526,7 @@ Console.WriteLine("changeadd 1"); { if (Body == IntPtr.Zero) enableBody(); + //Prim auto disable after 20 frames, //if you move it, re-enable the prim manually. if (_parent != null) @@ -1536,6 +1537,7 @@ Console.WriteLine("changeadd 1"); m_linkJoint = IntPtr.Zero; } } + if (Body != IntPtr.Zero) { d.BodySetPosition(Body, _position.X, _position.Y, _position.Z); @@ -1599,7 +1601,6 @@ Console.WriteLine(" JointCreateFixed"); float fy = 0; float fz = 0; - if (IsPhysical && (Body != IntPtr.Zero) && !m_isSelected && !childPrim) // KF: Only move root prims. { if (m_vehicle.Type != Vehicle.TYPE_NONE) @@ -1818,7 +1819,6 @@ Console.WriteLine(" JointCreateFixed"); // 35x10 = 350n times the mass per second applied maximum. float nmax = 35f * m_mass; float nmin = -35f * m_mass; - if (fx > nmax) fx = nmax; -- cgit v1.1