From 3becda919e0cb82e29742c50923f1b72c1a02241 Mon Sep 17 00:00:00 2001 From: Justin Clark-Casey (justincc) Date: Mon, 21 Nov 2011 19:30:21 +0000 Subject: move geom/actor map maintenance into DestroyODEStructures()/AvatarGeomAndBodyCreation(). This saves us having to do it separately when a character capsule size is changed --- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 17 +++++++++-------- OpenSim/Region/Physics/OdePlugin/OdeScene.cs | 2 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index efe3b7e..0f1a897 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -655,6 +655,9 @@ namespace OpenSim.Region.Physics.OdePlugin // //m_log.Info("[PHYSICSAV]: Rotation: " + bodyrotation.M00 + " : " + bodyrotation.M01 + " : " + bodyrotation.M02 + " : " + bodyrotation.M10 + " : " + bodyrotation.M11 + " : " + bodyrotation.M12 + " : " + bodyrotation.M20 + " : " + bodyrotation.M21 + " : " + bodyrotation.M22); //standupStraight(); + + _parent_scene.geom_name_map[Shell] = Name; + _parent_scene.actor_name_map[Shell] = this; } /// @@ -896,7 +899,7 @@ namespace OpenSim.Region.Physics.OdePlugin if (!localPos.IsFinite()) { - m_log.Warn("[PHYSICS]: Avatar Position is non-finite!"); + m_log.WarnFormat("[PHYSICS]: Avatar Position of {0} is non-finite!", Name); defects.Add(this); // _parent_scene.RemoveCharacter(this); @@ -1059,9 +1062,10 @@ namespace OpenSim.Region.Physics.OdePlugin { bad = true; _parent_scene.BadCharacter(this); + DestroyOdeStructures(); newPos = new d.Vector3(_position.X, _position.Y, _position.Z); base.RaiseOutOfBounds(_position); // Tells ScenePresence that there's a problem! - m_log.WarnFormat("[ODEPLUGIN]: Avatar Null reference for Avatar {0}, physical actor {1}", Name, m_uuid); + m_log.WarnFormat("[ODE CHARACTER]: Avatar Null reference for Avatar {0}, physical actor {1}", Name, m_uuid); } // kluge to keep things in bounds. ODE lets dead avatars drift away (they should be removed!) @@ -1164,6 +1168,9 @@ namespace OpenSim.Region.Physics.OdePlugin if (Shell != IntPtr.Zero) { d.GeomDestroy(Shell); + _parent_scene.geom_name_map.Remove(Shell); + _parent_scene.actor_name_map.Remove(Shell); + Shell = IntPtr.Zero; } } @@ -1296,9 +1303,6 @@ namespace OpenSim.Region.Physics.OdePlugin 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() DestroyOdeStructures(); @@ -1313,9 +1317,6 @@ namespace OpenSim.Region.Physics.OdePlugin // 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] = Name; - _parent_scene.actor_name_map[Shell] = this; } else { diff --git a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs index d5c3250..05455dc 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -1716,8 +1716,6 @@ namespace OpenSim.Region.Physics.OdePlugin if (!_characters.Contains(chr)) { _characters.Add(chr); - geom_name_map[chr.Shell] = Name; - actor_name_map[chr.Shell] = chr; if (chr.bad) m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); -- cgit v1.1