diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index cb2d26f0ac..f9562ff39b 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -598,13 +598,11 @@ namespace OpenSim.Region.Physics.OdePlugin d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2)); } - d.GeomSetRotation(Shell, ref m_caprot); d.BodySetRotation(Body, ref m_caprot); d.GeomSetBody(Shell, Body); - // The purpose of the AMotor here is to keep the avatar's physical // surrogate from rotating while moving Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); @@ -659,7 +657,6 @@ namespace OpenSim.Region.Physics.OdePlugin //standupStraight(); } - // /// /// Uses the capped cyllinder volume formula to calculate the avatar's mass. /// This may be used in calculations in the scene/scenepresence @@ -1158,14 +1155,12 @@ namespace OpenSim.Region.Physics.OdePlugin { //kill the body d.BodyDestroy(Body); - Body = IntPtr.Zero; } if (Shell != IntPtr.Zero) { d.GeomDestroy(Shell); - _parent_scene.geom_name_map.Remove(Shell); Shell = IntPtr.Zero; } } @@ -1262,10 +1257,8 @@ namespace OpenSim.Region.Physics.OdePlugin + (Body!=IntPtr.Zero ? "Body ":"") + (Amotor!=IntPtr.Zero ? "Amotor ":"")); } + AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); - - _parent_scene.geom_name_map[Shell] = Name; - _parent_scene.actor_name_map[Shell] = this; _parent_scene.AddCharacter(this); } else @@ -1301,7 +1294,7 @@ namespace OpenSim.Region.Physics.OdePlugin // Velocity = Vector3.Zero; _parent_scene.geom_name_map[Shell] = Name; - _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; + _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 6d1186ae8c..a62fdb7135 100644 --- a/OpenSim/Region/Physics/OdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/OdePlugin/OdeScene.cs @@ -233,8 +233,23 @@ namespace OpenSim.Region.Physics.OdePlugin private readonly List _collisionEventPrim = new List(); private readonly HashSet _badCharacter = new HashSet(); + + /// + /// Maps a unique geometry id (a memory location) to a physics actor name. + /// + /// + /// Only actors participating in collisions have geometries. + /// public Dictionary geom_name_map = new Dictionary(); + + /// + /// Maps a unique geometry id (a memory location) to a physics actor. + /// + /// + /// Only actors participating in collisions have geometries. + /// public Dictionary actor_name_map = new Dictionary(); + private bool m_NINJA_physics_joints_enabled = false; //private Dictionary jointpart_name_map = new Dictionary(); private readonly Dictionary> joints_connecting_actor = new Dictionary>(); @@ -1697,8 +1712,11 @@ 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.DebugFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); + m_log.ErrorFormat("[PHYSICS] Added BAD actor {0} to characters list", chr.m_uuid); } } } @@ -1710,6 +1728,8 @@ namespace OpenSim.Region.Physics.OdePlugin if (_characters.Contains(chr)) { _characters.Remove(chr); + geom_name_map.Remove(chr.Shell); + actor_name_map.Remove(chr.Shell); } } }