diff options
author | Kitto Flora | 2010-07-13 20:37:13 +0000 |
---|---|---|
committer | Kitto Flora | 2010-07-13 20:37:13 +0000 |
commit | 7ab103c96f3e82cac592f20d61358e1928da8e27 (patch) | |
tree | 0dd397de0b82b9eb2109847122d61bd86134b65e /OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | |
parent | Removed the CHANGED_COLOR event post from the Color accessor in SOP. This is ... (diff) | |
download | opensim-SC_OLD-7ab103c96f3e82cac592f20d61358e1928da8e27.zip opensim-SC_OLD-7ab103c96f3e82cac592f20d61358e1928da8e27.tar.gz opensim-SC_OLD-7ab103c96f3e82cac592f20d61358e1928da8e27.tar.bz2 opensim-SC_OLD-7ab103c96f3e82cac592f20d61358e1928da8e27.tar.xz |
Rewrite collision dictionary handling, cleans up deleted obects/avs. Fixes occasional collision event failure. ChOde only.
Diffstat (limited to 'OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs')
-rw-r--r-- | OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | 90 |
1 files changed, 71 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs index 38c38b6..61c16b8 100644 --- a/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/ChOdePlugin/ODECharacter.cs | |||
@@ -565,7 +565,29 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
565 | CAPSULE_RADIUS = 0.01f; | 565 | CAPSULE_RADIUS = 0.01f; |
566 | 566 | ||
567 | } | 567 | } |
568 | |||
569 | if(Shell != IntPtr.Zero) | ||
570 | { | ||
571 | try | ||
572 | { | ||
573 | d.GeomDestroy(Shell); | ||
574 | } | ||
575 | catch (System.AccessViolationException) | ||
576 | { | ||
577 | m_log.Error("[PHYSICS]: PrimGeom dead"); | ||
578 | } | ||
579 | // Remove any old entries | ||
580 | //string tShell; | ||
581 | //_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); | ||
582 | //Console.WriteLine("**** Remove {0}", tShell); | ||
583 | if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); | ||
584 | if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); | ||
585 | } | ||
586 | |||
568 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); | 587 | Shell = d.CreateCapsule(_parent_scene.space, CAPSULE_RADIUS, CAPSULE_LENGTH); |
588 | _parent_scene.geom_name_map[Shell] = m_name; | ||
589 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; | ||
590 | //Console.WriteLine("**** Create {2} Dicts: actor={0} name={1}", _parent_scene.actor_name_map.Count, _parent_scene.geom_name_map.Count, m_name); | ||
569 | 591 | ||
570 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); | 592 | d.GeomSetCategoryBits(Shell, (int)m_collisionCategories); |
571 | d.GeomSetCollideBits(Shell, (int)m_collisionFlags); | 593 | d.GeomSetCollideBits(Shell, (int)m_collisionFlags); |
@@ -931,10 +953,23 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
931 | Body = IntPtr.Zero; | 953 | Body = IntPtr.Zero; |
932 | } | 954 | } |
933 | 955 | ||
934 | if (Shell != IntPtr.Zero) | 956 | if(Shell != IntPtr.Zero) |
935 | { | 957 | { |
936 | d.GeomDestroy(Shell); | 958 | try |
937 | _parent_scene.geom_name_map.Remove(Shell); | 959 | { |
960 | d.GeomDestroy(Shell); | ||
961 | } | ||
962 | catch (System.AccessViolationException) | ||
963 | { | ||
964 | m_log.Error("[PHYSICS]: PrimGeom dead"); | ||
965 | } | ||
966 | // Remove any old entries | ||
967 | //string tShell; | ||
968 | //_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); | ||
969 | //Console.WriteLine("**** Remove {0}", tShell); | ||
970 | |||
971 | if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); | ||
972 | if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); | ||
938 | Shell = IntPtr.Zero; | 973 | Shell = IntPtr.Zero; |
939 | } | 974 | } |
940 | 975 | ||
@@ -1097,11 +1132,24 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1097 | 1132 | ||
1098 | Body = IntPtr.Zero; | 1133 | Body = IntPtr.Zero; |
1099 | } | 1134 | } |
1100 | 1135 | ||
1101 | if (Shell != IntPtr.Zero) | 1136 | if(Shell != IntPtr.Zero) |
1102 | { | 1137 | { |
1103 | d.GeomDestroy(Shell); | 1138 | try |
1104 | _parent_scene.geom_name_map.Remove(Shell); | 1139 | { |
1140 | d.GeomDestroy(Shell); | ||
1141 | } | ||
1142 | catch (System.AccessViolationException) | ||
1143 | { | ||
1144 | m_log.Error("[PHYSICS]: PrimGeom dead"); | ||
1145 | } | ||
1146 | // Remove any old entries | ||
1147 | //string tShell; | ||
1148 | //_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); | ||
1149 | //Console.WriteLine("**** Remove {0}", tShell); | ||
1150 | |||
1151 | if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); | ||
1152 | if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); | ||
1105 | Shell = IntPtr.Zero; | 1153 | Shell = IntPtr.Zero; |
1106 | } | 1154 | } |
1107 | } | 1155 | } |
@@ -1277,9 +1325,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1277 | + (Amotor!=IntPtr.Zero ? "Amotor ":"")); | 1325 | + (Amotor!=IntPtr.Zero ? "Amotor ":"")); |
1278 | } | 1326 | } |
1279 | AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); | 1327 | AvatarGeomAndBodyCreation(_position.X, _position.Y, _position.Z, m_tensor); |
1280 | |||
1281 | _parent_scene.geom_name_map[Shell] = m_name; | ||
1282 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; | ||
1283 | _parent_scene.AddCharacter(this); | 1328 | _parent_scene.AddCharacter(this); |
1284 | } | 1329 | } |
1285 | else | 1330 | else |
@@ -1299,17 +1344,28 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1299 | { | 1344 | { |
1300 | //kill the body | 1345 | //kill the body |
1301 | d.BodyDestroy(Body); | 1346 | d.BodyDestroy(Body); |
1302 | |||
1303 | Body = IntPtr.Zero; | 1347 | Body = IntPtr.Zero; |
1304 | } | 1348 | } |
1305 | 1349 | ||
1306 | if (Shell != IntPtr.Zero) | 1350 | if(Shell != IntPtr.Zero) |
1307 | { | 1351 | { |
1308 | d.GeomDestroy(Shell); | 1352 | try |
1309 | _parent_scene.geom_name_map.Remove(Shell); | 1353 | { |
1354 | d.GeomDestroy(Shell); | ||
1355 | } | ||
1356 | catch (System.AccessViolationException) | ||
1357 | { | ||
1358 | m_log.Error("[PHYSICS]: PrimGeom dead"); | ||
1359 | } | ||
1360 | // Remove any old entries | ||
1361 | //string tShell; | ||
1362 | //_parent_scene.geom_name_map.TryGetValue(Shell, out tShell); | ||
1363 | //Console.WriteLine("**** Remove {0}", tShell); | ||
1364 | |||
1365 | if(_parent_scene.geom_name_map.ContainsKey(Shell)) _parent_scene.geom_name_map.Remove(Shell); | ||
1366 | if(_parent_scene.actor_name_map.ContainsKey(Shell)) _parent_scene.actor_name_map.Remove(Shell); | ||
1310 | Shell = IntPtr.Zero; | 1367 | Shell = IntPtr.Zero; |
1311 | } | 1368 | } |
1312 | |||
1313 | } | 1369 | } |
1314 | 1370 | ||
1315 | m_isPhysical = m_tainted_isPhysical; | 1371 | m_isPhysical = m_tainted_isPhysical; |
@@ -1327,13 +1383,9 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1327 | CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; | 1383 | CAPSULE_LENGTH = m_tainted_CAPSULE_LENGTH; |
1328 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); | 1384 | //m_log.Info("[SIZE]: " + CAPSULE_LENGTH.ToString()); |
1329 | d.BodyDestroy(Body); | 1385 | d.BodyDestroy(Body); |
1330 | d.GeomDestroy(Shell); | ||
1331 | AvatarGeomAndBodyCreation(_position.X, _position.Y, | 1386 | AvatarGeomAndBodyCreation(_position.X, _position.Y, |
1332 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); | 1387 | _position.Z + (Math.Abs(CAPSULE_LENGTH - prevCapsule) * 2), m_tensor); |
1333 | Velocity = Vector3.Zero; | 1388 | Velocity = Vector3.Zero; |
1334 | |||
1335 | _parent_scene.geom_name_map[Shell] = m_name; | ||
1336 | _parent_scene.actor_name_map[Shell] = (PhysicsActor)this; | ||
1337 | } | 1389 | } |
1338 | else | 1390 | else |
1339 | { | 1391 | { |