When changing avatar size in ODE, remove the old actor from the name and actor maps

iar_mods
Justin Clark-Casey (justincc) 2011-11-21 19:06:53 +00:00
parent 898904d83d
commit 4faac1f090
2 changed files with 14 additions and 8 deletions

View File

@ -526,7 +526,6 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
} }
// movementVector.Z is zero // movementVector.Z is zero
// calculate tilt components based on desired amount of tilt and current (snapped) heading. // 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) 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; 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() // 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; float prevCapsule = CAPSULE_LENGTH;
CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH;
//m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString());
d.BodyDestroy(Body);
d.GeomDestroy(Shell);
AvatarGeomAndBodyCreation( AvatarGeomAndBodyCreation(
_position.X, _position.X,
_position.Y, _position.Y,
@ -1315,7 +1319,7 @@ namespace OpenSim.Region.Physics.OdePlugin
} }
else 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 ":"") + (Shell==IntPtr.Zero ? "Shell ":"")
+ (Body==IntPtr.Zero ? "Body ":"") + (Body==IntPtr.Zero ? "Body ":"")
+ (Amotor==IntPtr.Zero ? "Amotor ":"")); + (Amotor==IntPtr.Zero ? "Amotor ":""));

View File

@ -243,7 +243,9 @@ namespace OpenSim.Region.Physics.OdePlugin
/// Maps a unique geometry id (a memory location) to a physics actor name. /// Maps a unique geometry id (a memory location) to a physics actor name.
/// </summary> /// </summary>
/// <remarks> /// <remarks>
/// 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
/// </remarks> /// </remarks>
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>(); public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();