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

0.7.2-post-fixes
Justin Clark-Casey (justincc) 2011-11-21 19:06:53 +00:00
parent 1850b778e2
commit 8ea97cc608
2 changed files with 14 additions and 8 deletions

View File

@ -525,7 +525,6 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
// movementVector.Z is zero
// calculate tilt components based on desired amount of tilt and current (snapped) heading.
@ -1274,16 +1273,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,
@ -1298,7 +1302,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 ":""));

View File

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