From 4faac1f090b668274e9a07356b8a093d1b662b7e Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 19:06:53 +0000 Subject: When changing avatar size in ODE, remove the old actor from the name and actor maps --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 18 +++++++++++------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 4 +++- 2 files changed, 14 insertions(+), 8 deletions(-) (limited to 'OpenSim/Region/Physics') diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index 3e7fadf..efe3b7e 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -526,7 +526,6 @@ namespace OpenSim.Region.Physics.OdePlugin } } - // movementVector.Z is zero // calculate tilt components based on desired amount of tilt and current (snapped) heading. @@ -1291,16 +1290,21 @@ namespace OpenSim.Region.Physics.OdePlugin { if (Shell != IntPtr.Zero && Body != IntPtr.Zero && Amotor != IntPtr.Zero) { -// m_log.DebugFormat("[PHYSICS]: Changing capsule size"); +// m_log.DebugFormat( +// "[ODE CHARACTER]: Changing capsule size from {0} to {1} for {2}", +// CAPSULE_LENGTH, m_tainted_CAPSULE_LENGTH, Name); m_pidControllerActive = true; + + _parent_scene.geom_name_map.Remove(Shell); + _parent_scene.actor_name_map.Remove(Shell); + // no lock needed on _parent_scene.OdeLock because we are called from within the thread lock in OdePlugin's simulate() - d.JointDestroy(Amotor); + DestroyOdeStructures(); + float prevCapsule = CAPSULE_LENGTH; CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; - //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); - d.BodyDestroy(Body); - d.GeomDestroy(Shell); + AvatarGeomAndBodyCreation( _position.X, _position.Y, @@ -1315,7 +1319,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - m_log.Warn("[PHYSICS]: trying to change capsule size, but the following ODE data is missing - " + m_log.Warn("[ODE CHARACTER]: trying to change capsule size, but the following ODE data is missing - " + (Shell==IntPtr.Zero ? "Shell ":"") + (Body==IntPtr.Zero ? "Body ":"") + (Amotor==IntPtr.Zero ? "Amotor ":"")); diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index 9dee07b..d5c3250 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -243,7 +243,9 @@ namespace OpenSim.Region.Physics.OdePlugin /// Maps a unique geometry id (a memory location) to a physics actor name. /// /// - /// Only actors participating in collisions have geometries. + /// Only actors participating in collisions have geometries. This has to be maintained separately from + /// actor_name_map because terrain and water currently don't conceptually have a physics actor of their own + /// apart from the singleton PANull /// public Dictionary geom_name_map = new Dictionary(); -- cgit v1.1