diff options
author | UbitUmarov | 2012-07-13 23:57:45 +0100 |
---|---|---|
committer | UbitUmarov | 2012-07-13 23:57:45 +0100 |
commit | 72e2b9409462861d183ac7b391f5911defcd3bb0 (patch) | |
tree | 8e150a48fd887300750a51edb7cb213b70f89acc /OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |
parent | missed fix on vehicle reference frame (diff) | |
download | opensim-SC-72e2b9409462861d183ac7b391f5911defcd3bb0.zip opensim-SC-72e2b9409462861d183ac7b391f5911defcd3bb0.tar.gz opensim-SC-72e2b9409462861d183ac7b391f5911defcd3bb0.tar.bz2 opensim-SC-72e2b9409462861d183ac7b391f5911defcd3bb0.tar.xz |
In collisions report linksets root parts to parts, and not all parts.
Temporary suspend collision checks on full stopped bodies, until a better
away is found wake them, avoiding spurius collision end and start events.
Until a nice way is found to avoid them, this may cause some higher cpu load. plus some clean up
Diffstat (limited to 'OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs')
-rw-r--r-- | OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | 40 |
1 files changed, 23 insertions, 17 deletions
diff --git a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs index 088d2ba..659180d 100644 --- a/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs +++ b/OpenSim/Region/Physics/UbitOdePlugin/OdeScene.cs | |||
@@ -1171,6 +1171,8 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1171 | OdePrim cp1; | 1171 | OdePrim cp1; |
1172 | OdeCharacter cc2; | 1172 | OdeCharacter cc2; |
1173 | OdePrim cp2; | 1173 | OdePrim cp2; |
1174 | OdePrim cp1Parent; | ||
1175 | OdePrim cp2Parent; | ||
1174 | 1176 | ||
1175 | uint obj2LocalID = 0; | 1177 | uint obj2LocalID = 0; |
1176 | bool p1events = p1.SubscribedEvents(); | 1178 | bool p1events = p1.SubscribedEvents(); |
@@ -1207,18 +1209,19 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1207 | { | 1209 | { |
1208 | case ActorTypes.Agent: | 1210 | case ActorTypes.Agent: |
1209 | cc2 = (OdeCharacter)p2; | 1211 | cc2 = (OdeCharacter)p2; |
1210 | obj2LocalID = cc2.m_localID; | 1212 | obj2LocalID = cc2.LocalID; |
1211 | if (p2events) | 1213 | if (p2events) |
1212 | cc2.AddCollisionEvent(cc1.m_localID, contact); | 1214 | cc2.AddCollisionEvent(cc1.LocalID, contact); |
1213 | break; | 1215 | break; |
1214 | 1216 | ||
1215 | case ActorTypes.Prim: | 1217 | case ActorTypes.Prim: |
1216 | if (p2 is OdePrim) | 1218 | if (p2 is OdePrim) |
1217 | { | 1219 | { |
1218 | cp2 = (OdePrim)p2; | 1220 | cp2 = (OdePrim)p2; |
1219 | obj2LocalID = cp2.m_localID; | ||
1220 | if (p2events) | 1221 | if (p2events) |
1221 | cp2.AddCollisionEvent(cc1.m_localID, contact); | 1222 | cp2.AddCollisionEvent(cc1.LocalID, contact); |
1223 | cp2 = cp2.Parent; | ||
1224 | obj2LocalID = cp2.LocalID; | ||
1222 | } | 1225 | } |
1223 | break; | 1226 | break; |
1224 | 1227 | ||
@@ -1240,17 +1243,16 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1240 | if (p1 is OdePrim) | 1243 | if (p1 is OdePrim) |
1241 | { | 1244 | { |
1242 | cp1 = (OdePrim)p1; | 1245 | cp1 = (OdePrim)p1; |
1243 | 1246 | cp1Parent = cp1.Parent; | |
1244 | // obj1LocalID = cp2.m_localID; | ||
1245 | switch ((ActorTypes)p2.PhysicsActorType) | 1247 | switch ((ActorTypes)p2.PhysicsActorType) |
1246 | { | 1248 | { |
1247 | case ActorTypes.Agent: | 1249 | case ActorTypes.Agent: |
1248 | if (p2 is OdeCharacter) | 1250 | if (p2 is OdeCharacter) |
1249 | { | 1251 | { |
1250 | cc2 = (OdeCharacter)p2; | 1252 | cc2 = (OdeCharacter)p2; |
1251 | obj2LocalID = cc2.m_localID; | 1253 | obj2LocalID = cc2.LocalID; |
1252 | if (p2events) | 1254 | if (p2events) |
1253 | cc2.AddCollisionEvent(cp1.m_localID, contact); | 1255 | cc2.AddCollisionEvent(cp1Parent.LocalID, contact); |
1254 | } | 1256 | } |
1255 | break; | 1257 | break; |
1256 | case ActorTypes.Prim: | 1258 | case ActorTypes.Prim: |
@@ -1258,9 +1260,10 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1258 | if (p2 is OdePrim) | 1260 | if (p2 is OdePrim) |
1259 | { | 1261 | { |
1260 | cp2 = (OdePrim)p2; | 1262 | cp2 = (OdePrim)p2; |
1261 | obj2LocalID = cp2.m_localID; | ||
1262 | if (p2events) | 1263 | if (p2events) |
1263 | cp2.AddCollisionEvent(cp1.m_localID, contact); | 1264 | cp2.AddCollisionEvent(cp1Parent.LocalID, contact); |
1265 | cp2 = cp2.Parent; | ||
1266 | obj2LocalID = cp2.LocalID; | ||
1264 | } | 1267 | } |
1265 | break; | 1268 | break; |
1266 | 1269 | ||
@@ -1286,7 +1289,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1286 | if (p2 is OdeCharacter) | 1289 | if (p2 is OdeCharacter) |
1287 | { | 1290 | { |
1288 | cc2 = (OdeCharacter)p2; | 1291 | cc2 = (OdeCharacter)p2; |
1289 | obj2LocalID = cc2.m_localID; | 1292 | obj2LocalID = cc2.LocalID; |
1290 | if (p2events) | 1293 | if (p2events) |
1291 | cc2.AddCollisionEvent(0, contact); | 1294 | cc2.AddCollisionEvent(0, contact); |
1292 | } | 1295 | } |
@@ -1295,7 +1298,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1295 | if (p2 is OdePrim) | 1298 | if (p2 is OdePrim) |
1296 | { | 1299 | { |
1297 | cp2 = (OdePrim)p2; | 1300 | cp2 = (OdePrim)p2; |
1298 | obj2LocalID = cp2.m_localID; | 1301 | obj2LocalID = cp2.LocalID; |
1299 | if (p2events) | 1302 | if (p2events) |
1300 | cp2.AddCollisionEvent(0, contact); | 1303 | cp2.AddCollisionEvent(0, contact); |
1301 | } | 1304 | } |
@@ -1350,8 +1353,11 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1350 | { | 1353 | { |
1351 | foreach (OdePrim prm in _activegroups) | 1354 | foreach (OdePrim prm in _activegroups) |
1352 | { | 1355 | { |
1353 | if (d.BodyIsEnabled(prm.Body) && !prm.m_outbounds) | 1356 | if (!prm.m_outbounds) |
1354 | 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 | } | ||
1355 | } | 1361 | } |
1356 | } | 1362 | } |
1357 | catch (AccessViolationException) | 1363 | catch (AccessViolationException) |
@@ -1604,7 +1610,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
1604 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); | 1610 | //Console.WriteLine("RemovePrimThreadLocked " + prim.m_primName); |
1605 | lock (prim) | 1611 | lock (prim) |
1606 | { | 1612 | { |
1607 | RemoveCollisionEventReporting(prim); | 1613 | // RemoveCollisionEventReporting(prim); |
1608 | lock (_prims) | 1614 | lock (_prims) |
1609 | _prims.Remove(prim); | 1615 | _prims.Remove(prim); |
1610 | } | 1616 | } |
@@ -2012,6 +2018,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2012 | case ActorTypes.Prim: | 2018 | case ActorTypes.Prim: |
2013 | OdePrim pobj = (OdePrim)obj; | 2019 | OdePrim pobj = (OdePrim)obj; |
2014 | 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) | ||
2015 | { | 2022 | { |
2016 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); | 2023 | pobj.AddCollisionFrameTime((int)(odetimestepMS)); |
2017 | pobj.SendCollisions(); | 2024 | pobj.SendCollisions(); |
@@ -2728,7 +2735,6 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2728 | WaterMapHandler.Free(); | 2735 | WaterMapHandler.Free(); |
2729 | } | 2736 | } |
2730 | 2737 | ||
2731 | |||
2732 | if (ContactgeomsArray != IntPtr.Zero) | 2738 | if (ContactgeomsArray != IntPtr.Zero) |
2733 | Marshal.FreeHGlobal(ContactgeomsArray); | 2739 | Marshal.FreeHGlobal(ContactgeomsArray); |
2734 | if (GlobalContactsArray != IntPtr.Zero) | 2740 | if (GlobalContactsArray != IntPtr.Zero) |
@@ -2751,7 +2757,7 @@ namespace OpenSim.Region.Physics.OdePlugin | |||
2751 | { | 2757 | { |
2752 | if (prm.CollisionScore > 0) | 2758 | if (prm.CollisionScore > 0) |
2753 | { | 2759 | { |
2754 | returncolliders.Add(prm.m_localID, prm.CollisionScore); | 2760 | returncolliders.Add(prm.LocalID, prm.CollisionScore); |
2755 | cnt++; | 2761 | cnt++; |
2756 | prm.CollisionScore = 0f; | 2762 | prm.CollisionScore = 0f; |
2757 | if (cnt > 25) | 2763 | if (cnt > 25) |