aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs')
-rw-r--r--OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs54
1 files changed, 35 insertions, 19 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
index 7848b35..2928257 100644
--- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
+++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs
@@ -713,8 +713,18 @@ namespace OpenSim.Region.Physics.OdePlugin
713 713
714 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact)) 714 if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
715 return; 715 return;
716 716 if(d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc ||
717 count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf); 717 d.GeomGetCategoryBits(g1) == (uint)CollisionCategories.VolumeDtc)
718 {
719 int cflags;
720 unchecked
721 {
722 cflags = (int)(1 | d.CONTACTS_UNIMPORTANT);
723 }
724 count = d.CollidePtr(g1, g2, cflags, ContactgeomsArray, d.ContactGeom.unmanagedSizeOf);
725 }
726 else
727 count = d.CollidePtr(g1, g2, (contactsPerCollision & 0xffff), ContactgeomsArray, d.ContactGeom.unmanagedSizeOf);
718 } 728 }
719 catch (SEHException) 729 catch (SEHException)
720 { 730 {
@@ -1161,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin
1161 OdePrim cp1; 1171 OdePrim cp1;
1162 OdeCharacter cc2; 1172 OdeCharacter cc2;
1163 OdePrim cp2; 1173 OdePrim cp2;
1174 OdePrim cp1Parent;
1175 OdePrim cp2Parent;
1164 1176
1165 uint obj2LocalID = 0; 1177 uint obj2LocalID = 0;
1166 bool p1events = p1.SubscribedEvents(); 1178 bool p1events = p1.SubscribedEvents();
@@ -1197,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin
1197 { 1209 {
1198 case ActorTypes.Agent: 1210 case ActorTypes.Agent:
1199 cc2 = (OdeCharacter)p2; 1211 cc2 = (OdeCharacter)p2;
1200 obj2LocalID = cc2.m_localID; 1212 obj2LocalID = cc2.LocalID;
1201 if (p2events) 1213 if (p2events)
1202 cc2.AddCollisionEvent(cc1.m_localID, contact); 1214 cc2.AddCollisionEvent(cc1.LocalID, contact);
1203 break; 1215 break;
1204 1216
1205 case ActorTypes.Prim: 1217 case ActorTypes.Prim:
1206 if (p2 is OdePrim) 1218 if (p2 is OdePrim)
1207 { 1219 {
1208 cp2 = (OdePrim)p2; 1220 cp2 = (OdePrim)p2;
1209 obj2LocalID = cp2.m_localID;
1210 if (p2events) 1221 if (p2events)
1211 cp2.AddCollisionEvent(cc1.m_localID, contact); 1222 cp2.AddCollisionEvent(cc1.LocalID, contact);
1223 cp2 = cp2.Parent;
1224 obj2LocalID = cp2.LocalID;
1212 } 1225 }
1213 break; 1226 break;
1214 1227
@@ -1230,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1230 if (p1 is OdePrim) 1243 if (p1 is OdePrim)
1231 { 1244 {
1232 cp1 = (OdePrim)p1; 1245 cp1 = (OdePrim)p1;
1233 1246 cp1Parent = cp1.Parent;
1234 // obj1LocalID = cp2.m_localID;
1235 switch ((ActorTypes)p2.PhysicsActorType) 1247 switch ((ActorTypes)p2.PhysicsActorType)
1236 { 1248 {
1237 case ActorTypes.Agent: 1249 case ActorTypes.Agent:
1238 if (p2 is OdeCharacter) 1250 if (p2 is OdeCharacter)
1239 { 1251 {
1240 cc2 = (OdeCharacter)p2; 1252 cc2 = (OdeCharacter)p2;
1241 obj2LocalID = cc2.m_localID; 1253 obj2LocalID = cc2.LocalID;
1242 if (p2events) 1254 if (p2events)
1243 cc2.AddCollisionEvent(cp1.m_localID, contact); 1255 cc2.AddCollisionEvent(cp1Parent.LocalID, contact);
1244 } 1256 }
1245 break; 1257 break;
1246 case ActorTypes.Prim: 1258 case ActorTypes.Prim:
@@ -1248,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin
1248 if (p2 is OdePrim) 1260 if (p2 is OdePrim)
1249 { 1261 {
1250 cp2 = (OdePrim)p2; 1262 cp2 = (OdePrim)p2;
1251 obj2LocalID = cp2.m_localID;
1252 if (p2events) 1263 if (p2events)
1253 cp2.AddCollisionEvent(cp1.m_localID, contact); 1264 cp2.AddCollisionEvent(cp1Parent.LocalID, contact);
1265 cp2 = cp2.Parent;
1266 obj2LocalID = cp2.LocalID;
1254 } 1267 }
1255 break; 1268 break;
1256 1269
@@ -1276,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1276 if (p2 is OdeCharacter) 1289 if (p2 is OdeCharacter)
1277 { 1290 {
1278 cc2 = (OdeCharacter)p2; 1291 cc2 = (OdeCharacter)p2;
1279 obj2LocalID = cc2.m_localID; 1292 obj2LocalID = cc2.LocalID;
1280 if (p2events) 1293 if (p2events)
1281 cc2.AddCollisionEvent(0, contact); 1294 cc2.AddCollisionEvent(0, contact);
1282 } 1295 }
@@ -1285,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1285 if (p2 is OdePrim) 1298 if (p2 is OdePrim)
1286 { 1299 {
1287 cp2 = (OdePrim)p2; 1300 cp2 = (OdePrim)p2;
1288 obj2LocalID = cp2.m_localID; 1301 obj2LocalID = cp2.LocalID;
1289 if (p2events) 1302 if (p2events)
1290 cp2.AddCollisionEvent(0, contact); 1303 cp2.AddCollisionEvent(0, contact);
1291 } 1304 }
@@ -1340,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin
1340 { 1353 {
1341 foreach (OdePrim prm in _activegroups) 1354 foreach (OdePrim prm in _activegroups)
1342 { 1355 {
1343 if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds) 1356 if (!prm.m_outbounds)
1344 d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback); 1357 {
1358 if (d.BodyIsEnabled(prm.Body))
1359 d.SpaceCollide2(StaticSpace, prm.collide_geom, IntPtr.Zero, nearCallback);
1360 }
1345 } 1361 }
1346 } 1362 }
1347 catch (AccessViolationException) 1363 catch (AccessViolationException)
@@ -1594,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1594 //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); 1610 //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName);
1595 lock (prim) 1611 lock (prim)
1596 { 1612 {
1597 RemoveCollisionEventReporting(prim); 1613// RemoveCollisionEventReporting(prim);
1598 lock (_prims) 1614 lock (_prims)
1599 _prims.Remove(prim); 1615 _prims.Remove(prim);
1600 } 1616 }
@@ -2002,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2002 case ActorTypes.Prim: 2018 case ActorTypes.Prim:
2003 OdePrim pobj = (OdePrim)obj; 2019 OdePrim pobj = (OdePrim)obj;
2004 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds)) 2020 if (pobj.Body == IntPtr.Zero || (d.BodyIsEnabled(pobj.Body) && !pobj.m_outbounds))
2021 if (!pobj.m_outbounds)
2005 { 2022 {
2006 pobj.AddCollisionFrameTime((int)(odetimestepMS)); 2023 pobj.AddCollisionFrameTime((int)(odetimestepMS));
2007 pobj.SendCollisions(); 2024 pobj.SendCollisions();
@@ -2718,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin
2718 WaterMapHandler.Free(); 2735 WaterMapHandler.Free();
2719 } 2736 }
2720 2737
2721
2722 if (ContactgeomsArray != IntPtr.Zero) 2738 if (ContactgeomsArray != IntPtr.Zero)
2723 Marshal.FreeHGlobal(ContactgeomsArray); 2739 Marshal.FreeHGlobal(ContactgeomsArray);
2724 if (GlobalContactsArray != IntPtr.Zero) 2740 if (GlobalContactsArray != IntPtr.Zero)
@@ -2741,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2741 { 2757 {
2742 if (prm.CollisionScore > 0) 2758 if (prm.CollisionScore > 0)
2743 { 2759 {
2744 returncolliders.Add(prm.m_localID, prm.CollisionScore); 2760 returncolliders.Add(prm.LocalID, prm.CollisionScore);
2745 cnt++; 2761 cnt++;
2746 prm.CollisionScore = 0f; 2762 prm.CollisionScore = 0f;
2747 if (cnt > 25) 2763 if (cnt > 25)