diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 3e7fadf5e3..efe3b7ea03 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 9dee07bb5c..d5c32506a7 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();