aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-11-21 18:27:41 +0000
committerJustin Clark-Casey (justincc)2011-11-21 18:27:41 +0000
commit898904d83d371b69d001b669588f29c2befd6aa9 (patch)
tree8a6c6722901d44c53370fd6475a370db8dc5b08b /OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
parentHave ODECharacter and ODEPrim both use PhysicsActor.Name instead of maintaini... (diff)
downloadopensim-SC-898904d83d371b69d001b669588f29c2befd6aa9.zip
opensim-SC-898904d83d371b69d001b669588f29c2befd6aa9.tar.gz
opensim-SC-898904d83d371b69d001b669588f29c2befd6aa9.tar.bz2
opensim-SC-898904d83d371b69d001b669588f29c2befd6aa9.tar.xz
When an ODECharacter is removed (e.g. when an avatar leaves a scene), remove the actor reference in OdeScene.actor_name_map rather than leaving it dangling.
This also largely centralizes adds/removes in OdeScene.AddCharacter()/RemoveCharacter()
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/ODECharacter.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs11
1 files changed, 2 insertions, 9 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
index 20bc7f6..3e7fadf 100644
--- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
+++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs
@@ -599,13 +599,11 @@ namespace OpenSim.Region.Physics.OdePlugin
599 d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2)); 599 d.RFromAxisAndAngle(out m_caprot, 0, 0, 1, (float)(Math.PI / 2));
600 } 600 }
601 601
602
603 d.GeomSetRotation(Shell, ref m_caprot); 602 d.GeomSetRotation(Shell, ref m_caprot);
604 d.BodySetRotation(Body, ref m_caprot); 603 d.BodySetRotation(Body, ref m_caprot);
605 604
606 d.GeomSetBody(Shell, Body); 605 d.GeomSetBody(Shell, Body);
607 606
608
609 // The purpose of the AMotor here is to keep the avatar's physical 607 // The purpose of the AMotor here is to keep the avatar's physical
610 // surrogate from rotating while moving 608 // surrogate from rotating while moving
611 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero); 609 Amotor = d.JointCreateAMotor(_parent_scene.world, IntPtr.Zero);
@@ -660,7 +658,6 @@ namespace OpenSim.Region.Physics.OdePlugin
660 //standupStraight(); 658 //standupStraight();
661 } 659 }
662 660
663 //
664 /// <summary> 661 /// <summary>
665 /// Uses the capped cyllinder volume formula to calculate the avatar's mass. 662 /// Uses the capped cyllinder volume formula to calculate the avatar's mass.
666 /// This may be used in calculations in the scene/scenepresence 663 /// This may be used in calculations in the scene/scenepresence
@@ -1162,14 +1159,12 @@ namespace OpenSim.Region.Physics.OdePlugin
1162 { 1159 {
1163 //kill the body 1160 //kill the body
1164 d.BodyDestroy(Body); 1161 d.BodyDestroy(Body);
1165
1166 Body = IntPtr.Zero; 1162 Body = IntPtr.Zero;
1167 } 1163 }
1168 1164
1169 if (Shell != IntPtr.Zero) 1165 if (Shell != IntPtr.Zero)
1170 { 1166 {
1171 d.GeomDestroy(Shell); 1167 d.GeomDestroy(Shell);
1172 _parent_scene.geom_name_map.Remove(Shell);
1173 Shell = IntPtr.Zero; 1168 Shell = IntPtr.Zero;
1174 } 1169 }
1175 } 1170 }
@@ -1279,10 +1274,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1279 + (Body!=IntPtr.Zero ? "Body ":"") 1274 + (Body!=IntPtr.Zero ? "Body ":"")
1280 + (Amotor!=IntPtr.Zero ? "Amotor ":"")); 1275 + (Amotor!=IntPtr.Zero ? "Amotor ":""));
1281 } 1276 }
1277
1282 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); 1278 AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor);
1283
1284 _parent_scene.geom_name_map[Shell] = Name;
1285 _parent_scene.actor_name_map[Shell] = this;
1286 _parent_scene.AddCharacter(this); 1279 _parent_scene.AddCharacter(this);
1287 } 1280 }
1288 else 1281 else
@@ -1318,7 +1311,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1318// Velocity = Vector3.Zero; 1311// Velocity = Vector3.Zero;
1319 1312
1320 _parent_scene.geom_name_map[Shell] = Name; 1313 _parent_scene.geom_name_map[Shell] = Name;
1321 _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; 1314 _parent_scene.actor_name_map[Shell] = this;
1322 } 1315 }
1323 else 1316 else
1324 { 1317 {