diff options
Diffstat (limited to 'OpenSim')
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | 1 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs | 73 | ||||
-rw-r--r-- | OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | 300 |
3 files changed, 8 insertions, 366 deletions
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs index 8f2215a..7c4dc46 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODEPrim.cs | |||
@@ -203,7 +203,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
203 | public int m_interpenetrationcount { get; private set; } | 203 | public int m_interpenetrationcount { get; private set; } |
204 | internal float m_collisionscore; | 204 | internal float m_collisionscore; |
205 | public int m_roundsUnderMotionThreshold { get; private set; } | 205 | public int m_roundsUnderMotionThreshold { get; private set; } |
206 | private int m_crossingfailures; | ||
207 | 206 | ||
208 | public bool outofBounds { get; private set; } | 207 | public bool outofBounds { get; private set; } |
209 | private float m_density = 10.000006836f; // Aluminum g/cm3; | 208 | private float m_density = 10.000006836f; // Aluminum g/cm3; |
diff --git a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs index e39b8c7..a21ec2b 100644 --- a/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs +++ b/OpenSim/Region/PhysicsModules/Ode/ODERayCastRequestManager.cs | |||
@@ -175,8 +175,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
175 | // this value may still be too large, depending on machine configuration | 175 | // this value may still be too large, depending on machine configuration |
176 | // of maximum stack | 176 | // of maximum stack |
177 | float len = req.length; | 177 | float len = req.length; |
178 | if (len > 250f) | 178 | if (len > 100f) |
179 | len = 250f; | 179 | len = 100f; |
180 | 180 | ||
181 | // Create the ray | 181 | // Create the ray |
182 | IntPtr ray = d.CreateRay(m_scene.space, len); | 182 | IntPtr ray = d.CreateRay(m_scene.space, len); |
@@ -226,8 +226,8 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
226 | { | 226 | { |
227 | // limit ray length or collisions will take all avaiable stack space | 227 | // limit ray length or collisions will take all avaiable stack space |
228 | float len = req.length; | 228 | float len = req.length; |
229 | if (len > 250f) | 229 | if (len > 100f) |
230 | len = 250f; | 230 | len = 100f; |
231 | 231 | ||
232 | // Create the ray | 232 | // Create the ray |
233 | IntPtr ray = d.CreateRay(m_scene.space, len); | 233 | IntPtr ray = d.CreateRay(m_scene.space, len); |
@@ -252,71 +252,10 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
252 | private void near(IntPtr space, IntPtr g1, IntPtr g2) | 252 | private void near(IntPtr space, IntPtr g1, IntPtr g2) |
253 | { | 253 | { |
254 | 254 | ||
255 | //Don't test against heightfield Geom, or you'll be sorry! | ||
256 | |||
257 | /* | ||
258 | terminate called after throwing an instance of 'std::bad_alloc' | ||
259 | what(): std::bad_alloc | ||
260 | Stacktrace: | ||
261 | |||
262 | at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0x00004> | ||
263 | at (wrapper managed-to-native) Ode.NET.d.Collide (intptr,intptr,int,Ode.NET.d/ContactGeom[],int) <0xffffffff> | ||
264 | at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0x00280> | ||
265 | at (wrapper native-to-managed) OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.near (intptr,intptr,intptr) <0xfff | ||
266 | fffff> | ||
267 | at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0x00004> | ||
268 | at (wrapper managed-to-native) Ode.NET.d.SpaceCollide2 (intptr,intptr,intptr,Ode.NET.d/NearCallback) <0xffffffff> | ||
269 | at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.RayCast (OpenSim.Region.Physics.OdePlugin.ODERayCastRequest) < | ||
270 | 0x00114> | ||
271 | at OpenSim.Region.Physics.OdePlugin.ODERayCastRequestManager.ProcessQueuedRequests () <0x000eb> | ||
272 | at OpenSim.Region.Physics.OdePlugin.OdeScene.Simulate (single) <0x017e6> | ||
273 | at OpenSim.Region.Framework.Scenes.SceneGraph.UpdatePhysics (double) <0x00042> | ||
274 | at OpenSim.Region.Framework.Scenes.Scene.Update () <0x0039e> | ||
275 | at OpenSim.Region.Framework.Scenes.Scene.Heartbeat (object) <0x00019> | ||
276 | at (wrapper runtime-invoke) object.runtime_invoke_void__this___object (object,intptr,intptr,intptr) <0xffffffff> | ||
277 | |||
278 | Native stacktrace: | ||
279 | |||
280 | mono [0x80d2a42] | ||
281 | [0xb7f5840c] | ||
282 | /lib/i686/cmov/libc.so.6(abort+0x188) [0xb7d1a018] | ||
283 | /usr/lib/libstdc++.so.6(_ZN9__gnu_cxx27__verbose_terminate_handlerEv+0x158) [0xb45fc988] | ||
284 | /usr/lib/libstdc++.so.6 [0xb45fa865] | ||
285 | /usr/lib/libstdc++.so.6 [0xb45fa8a2] | ||
286 | /usr/lib/libstdc++.so.6 [0xb45fa9da] | ||
287 | /usr/lib/libstdc++.so.6(_Znwj+0x83) [0xb45fb033] | ||
288 | /usr/lib/libstdc++.so.6(_Znaj+0x1d) [0xb45fb11d] | ||
289 | libode.so(_ZN13dxHeightfield23dCollideHeightfieldZoneEiiiiP6dxGeomiiP12dContactGeomi+0xd04) [0xb46678e4] | ||
290 | libode.so(_Z19dCollideHeightfieldP6dxGeomS0_iP12dContactGeomi+0x54b) [0xb466832b] | ||
291 | libode.so(dCollide+0x102) [0xb46571b2] | ||
292 | [0x95cfdec9] | ||
293 | [0x8ea07fe1] | ||
294 | [0xab260146] | ||
295 | libode.so [0xb465a5c4] | ||
296 | libode.so(_ZN11dxHashSpace8collide2EPvP6dxGeomPFvS0_S2_S2_E+0x75) [0xb465bcf5] | ||
297 | libode.so(dSpaceCollide2+0x177) [0xb465ac67] | ||
298 | [0x95cf978e] | ||
299 | [0x8ea07945] | ||
300 | [0x95cf2bbc] | ||
301 | [0xab2787e7] | ||
302 | [0xab419fb3] | ||
303 | [0xab416657] | ||
304 | [0xab415bda] | ||
305 | [0xb609b08e] | ||
306 | mono(mono_runtime_delegate_invoke+0x34) [0x8192534] | ||
307 | mono [0x81a2f0f] | ||
308 | mono [0x81d28b6] | ||
309 | mono [0x81ea2c6] | ||
310 | /lib/i686/cmov/libpthread.so.0 [0xb7e744c0] | ||
311 | /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb7dcd6de] | ||
312 | */ | ||
313 | |||
314 | // Exclude heightfield geom | ||
315 | |||
316 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) | 255 | if (g1 == IntPtr.Zero || g2 == IntPtr.Zero) |
317 | return; | 256 | return; |
318 | if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass) | 257 | // if (d.GeomGetClass(g1) == d.GeomClassID.HeightfieldClass || d.GeomGetClass(g2) == d.GeomClassID.HeightfieldClass) |
319 | return; | 258 | // return; |
320 | 259 | ||
321 | // Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms. | 260 | // Raytest against AABBs of spaces first, then dig into the spaces it hits for actual geoms. |
322 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) | 261 | if (d.GeomIsSpace(g1) || d.GeomIsSpace(g2)) |
diff --git a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs index 6f14121..8b369c8 100644 --- a/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs +++ b/OpenSim/Region/PhysicsModules/Ode/OdeScene.cs | |||
@@ -58,16 +58,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
58 | End = 2 | 58 | End = 2 |
59 | } | 59 | } |
60 | 60 | ||
61 | // public struct sCollisionData | ||
62 | // { | ||
63 | // public uint ColliderLocalId; | ||
64 | // public uint CollidedWithLocalId; | ||
65 | // public int NumberOfCollisions; | ||
66 | // public int CollisionType; | ||
67 | // public int StatusIndicator; | ||
68 | // public int lastframe; | ||
69 | // } | ||
70 | |||
71 | [Flags] | 61 | [Flags] |
72 | public enum CollisionCategories : int | 62 | public enum CollisionCategories : int |
73 | { | 63 | { |
@@ -323,7 +313,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
323 | public bool IsAvCapsuleTilted { get; private set; } | 313 | public bool IsAvCapsuleTilted { get; private set; } |
324 | 314 | ||
325 | private float avDensity = 80f; | 315 | private float avDensity = 80f; |
326 | // private float avHeightFudgeFactor = 0.52f; | ||
327 | private float avMovementDivisorWalk = 1.3f; | 316 | private float avMovementDivisorWalk = 1.3f; |
328 | private float avMovementDivisorRun = 0.8f; | 317 | private float avMovementDivisorRun = 0.8f; |
329 | private float minimumGroundFlightOffset = 3f; | 318 | private float minimumGroundFlightOffset = 3f; |
@@ -346,7 +335,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
346 | 335 | ||
347 | public int bodyFramesAutoDisable = 20; | 336 | public int bodyFramesAutoDisable = 20; |
348 | 337 | ||
349 | private float[] _watermap; | ||
350 | private bool m_filterCollisions = true; | 338 | private bool m_filterCollisions = true; |
351 | 339 | ||
352 | private d.NearCallback nearCallback; | 340 | private d.NearCallback nearCallback; |
@@ -457,31 +445,21 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
457 | private d.Contact WaterContact; | 445 | private d.Contact WaterContact; |
458 | private d.Contact[,] m_materialContacts; | 446 | private d.Contact[,] m_materialContacts; |
459 | 447 | ||
460 | //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it | ||
461 | //Ckrinke private int m_randomizeWater = 200; | ||
462 | private int m_physicsiterations = 10; | 448 | private int m_physicsiterations = 10; |
463 | private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag | 449 | private const float m_SkipFramesAtms = 0.40f; // Drop frames gracefully at a 400 ms lag |
464 | private readonly PhysicsActor PANull = new NullPhysicsActor(); | 450 | private readonly PhysicsActor PANull = new NullPhysicsActor(); |
465 | private float step_time = 0.0f; | 451 | private float step_time = 0.0f; |
466 | //Ckrinke: Comment out until used. We declare it, initialize it, but do not use it | ||
467 | //Ckrinke private int ms = 0; | ||
468 | public IntPtr world; | 452 | public IntPtr world; |
469 | //private bool returncollisions = false; | ||
470 | // private uint obj1LocalID = 0; | ||
471 | private uint obj2LocalID = 0; | 453 | private uint obj2LocalID = 0; |
472 | //private int ctype = 0; | ||
473 | private OdeCharacter cc1; | 454 | private OdeCharacter cc1; |
474 | private OdePrim cp1; | 455 | private OdePrim cp1; |
475 | private OdeCharacter cc2; | 456 | private OdeCharacter cc2; |
476 | private OdePrim cp2; | 457 | private OdePrim cp2; |
477 | private int p1ExpectedPoints = 0; | 458 | private int p1ExpectedPoints = 0; |
478 | private int p2ExpectedPoints = 0; | 459 | private int p2ExpectedPoints = 0; |
479 | //private int cStartStop = 0; | ||
480 | //private string cDictKey = ""; | ||
481 | 460 | ||
482 | public IntPtr space; | 461 | public IntPtr space; |
483 | 462 | ||
484 | //private IntPtr tmpSpace; | ||
485 | // split static geometry collision handling into spaces of 30 meters | 463 | // split static geometry collision handling into spaces of 30 meters |
486 | public IntPtr[,] staticPrimspace; | 464 | public IntPtr[,] staticPrimspace; |
487 | 465 | ||
@@ -565,8 +543,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
565 | m_suportCombine = false; | 543 | m_suportCombine = false; |
566 | 544 | ||
567 | nearCallback = near; | 545 | nearCallback = near; |
568 | // triCallback = TriCallback; | ||
569 | // triArrayCallback = TriArrayCallback; | ||
570 | m_rayCastManager = new ODERayCastRequestManager(this); | 546 | m_rayCastManager = new ODERayCastRequestManager(this); |
571 | 547 | ||
572 | // Create the world and the first space | 548 | // Create the world and the first space |
@@ -576,11 +552,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
576 | contactgroup = d.JointGroupCreate(0); | 552 | contactgroup = d.JointGroupCreate(0); |
577 | 553 | ||
578 | d.WorldSetAutoDisableFlag(world, false); | 554 | d.WorldSetAutoDisableFlag(world, false); |
579 | |||
580 | // _watermap = new float[258 * 258]; | ||
581 | |||
582 | // Zero out the prim spaces array (we split our space into smaller spaces so | ||
583 | // we can hit test less. | ||
584 | } | 555 | } |
585 | 556 | ||
586 | // Initialize from configs | 557 | // Initialize from configs |
@@ -708,8 +679,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
708 | spaceGridMaxX--; | 679 | spaceGridMaxX--; |
709 | spaceGridMaxY--; | 680 | spaceGridMaxY--; |
710 | 681 | ||
711 | |||
712 | |||
713 | // Centeral contact friction and bounce | 682 | // Centeral contact friction and bounce |
714 | // ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why | 683 | // ckrinke 11/10/08 Enabling soft_erp but not soft_cfm until I figure out why |
715 | // an avatar falls through in Z but not in X or Y when walking on a prim. | 684 | // an avatar falls through in Z but not in X or Y when walking on a prim. |
@@ -884,9 +853,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
884 | d.WorldSetLinearDampingThreshold(world, 256f); | 853 | d.WorldSetLinearDampingThreshold(world, 256f); |
885 | d.WorldSetMaxAngularSpeed(world, 256f); | 854 | d.WorldSetMaxAngularSpeed(world, 256f); |
886 | 855 | ||
887 | // Set how many steps we go without running collision testing | ||
888 | // This is in addition to the step size. | ||
889 | // Essentially Steps * m_physicsiterations | ||
890 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | 856 | d.WorldSetQuickStepNumIterations(world, m_physicsiterations); |
891 | //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); | 857 | //d.WorldSetContactMaxCorrectingVel(world, 1000.0f); |
892 | 858 | ||
@@ -901,22 +867,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
901 | _worldInitialized = true; | 867 | _worldInitialized = true; |
902 | } | 868 | } |
903 | 869 | ||
904 | // internal void waitForSpaceUnlock(IntPtr space) | ||
905 | // { | ||
906 | // //if (space != IntPtr.Zero) | ||
907 | // //while (d.SpaceLockQuery(space)) { } // Wait and do nothing | ||
908 | // } | ||
909 | |||
910 | // /// <summary> | ||
911 | // /// Debug space message for printing the space that a prim/avatar is in. | ||
912 | // /// </summary> | ||
913 | // /// <param name="pos"></param> | ||
914 | // /// <returns>Returns which split up space the given position is in.</returns> | ||
915 | // public string whichspaceamIin(Vector3 pos) | ||
916 | // { | ||
917 | // return calculateSpaceForGeom(pos).ToString(); | ||
918 | // } | ||
919 | |||
920 | #region Collision Detection | 870 | #region Collision Detection |
921 | 871 | ||
922 | /// <summary> | 872 | /// <summary> |
@@ -1042,12 +992,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1042 | name2 = "null"; | 992 | name2 = "null"; |
1043 | } | 993 | } |
1044 | 994 | ||
1045 | //if (id == d.GeomClassId.TriMeshClass) | ||
1046 | //{ | ||
1047 | // m_log.InfoFormat("near: A collision was detected between {1} and {2}", 0, name1, name2); | ||
1048 | //m_log.Debug("near: A collision was detected between {1} and {2}", 0, name1, name2); | ||
1049 | //} | ||
1050 | |||
1051 | // Figure out how many contact points we have | 995 | // Figure out how many contact points we have |
1052 | int count = 0; | 996 | int count = 0; |
1053 | 997 | ||
@@ -1166,110 +1110,9 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1166 | // we don't want prim or avatar to explode | 1110 | // we don't want prim or avatar to explode |
1167 | 1111 | ||
1168 | #region InterPenetration Handling - Unintended physics explosions | 1112 | #region InterPenetration Handling - Unintended physics explosions |
1169 | # region disabled code1 | ||
1170 | 1113 | ||
1171 | if (curContact.depth >= 0.08f) | 1114 | if (curContact.depth >= 0.08f) |
1172 | { | 1115 | { |
1173 | //This is disabled at the moment only because it needs more tweaking | ||
1174 | //It will eventually be uncommented | ||
1175 | /* | ||
1176 | if (contact.depth >= 1.00f) | ||
1177 | { | ||
1178 | //m_log.Debug("[PHYSICS]: " + contact.depth.ToString()); | ||
1179 | } | ||
1180 | |||
1181 | //If you interpenetrate a prim with an agent | ||
1182 | if ((p2.PhysicsActorType == (int) ActorTypes.Agent && | ||
1183 | p1.PhysicsActorType == (int) ActorTypes.Prim) || | ||
1184 | (p1.PhysicsActorType == (int) ActorTypes.Agent && | ||
1185 | p2.PhysicsActorType == (int) ActorTypes.Prim)) | ||
1186 | { | ||
1187 | |||
1188 | //contact.depth = contact.depth * 4.15f; | ||
1189 | /* | ||
1190 | if (p2.PhysicsActorType == (int) ActorTypes.Agent) | ||
1191 | { | ||
1192 | p2.CollidingObj = true; | ||
1193 | contact.depth = 0.003f; | ||
1194 | p2.Velocity = p2.Velocity + new PhysicsVector(0, 0, 2.5f); | ||
1195 | OdeCharacter character = (OdeCharacter) p2; | ||
1196 | character.SetPidStatus(true); | ||
1197 | contact.pos = new d.Vector3(contact.pos.X + (p1.Size.X / 2), contact.pos.Y + (p1.Size.Y / 2), contact.pos.Z + (p1.Size.Z / 2)); | ||
1198 | |||
1199 | } | ||
1200 | else | ||
1201 | { | ||
1202 | |||
1203 | //contact.depth = 0.0000000f; | ||
1204 | } | ||
1205 | if (p1.PhysicsActorType == (int) ActorTypes.Agent) | ||
1206 | { | ||
1207 | |||
1208 | p1.CollidingObj = true; | ||
1209 | contact.depth = 0.003f; | ||
1210 | p1.Velocity = p1.Velocity + new PhysicsVector(0, 0, 2.5f); | ||
1211 | contact.pos = new d.Vector3(contact.pos.X + (p2.Size.X / 2), contact.pos.Y + (p2.Size.Y / 2), contact.pos.Z + (p2.Size.Z / 2)); | ||
1212 | OdeCharacter character = (OdeCharacter)p1; | ||
1213 | character.SetPidStatus(true); | ||
1214 | } | ||
1215 | else | ||
1216 | { | ||
1217 | |||
1218 | //contact.depth = 0.0000000f; | ||
1219 | } | ||
1220 | |||
1221 | |||
1222 | |||
1223 | } | ||
1224 | */ | ||
1225 | // If you interpenetrate a prim with another prim | ||
1226 | /* | ||
1227 | if (p1.PhysicsActorType == (int) ActorTypes.Prim && p2.PhysicsActorType == (int) ActorTypes.Prim) | ||
1228 | { | ||
1229 | #region disabledcode2 | ||
1230 | //OdePrim op1 = (OdePrim)p1; | ||
1231 | //OdePrim op2 = (OdePrim)p2; | ||
1232 | //op1.m_collisionscore++; | ||
1233 | //op2.m_collisionscore++; | ||
1234 | |||
1235 | //if (op1.m_collisionscore > 8000 || op2.m_collisionscore > 8000) | ||
1236 | //{ | ||
1237 | //op1.m_taintdisable = true; | ||
1238 | //AddPhysicsActorTaint(p1); | ||
1239 | //op2.m_taintdisable = true; | ||
1240 | //AddPhysicsActorTaint(p2); | ||
1241 | //} | ||
1242 | |||
1243 | //if (contact.depth >= 0.25f) | ||
1244 | //{ | ||
1245 | // Don't collide, one or both prim will expld. | ||
1246 | |||
1247 | //op1.m_interpenetrationcount++; | ||
1248 | //op2.m_interpenetrationcount++; | ||
1249 | //interpenetrations_before_disable = 200; | ||
1250 | //if (op1.m_interpenetrationcount >= interpenetrations_before_disable) | ||
1251 | //{ | ||
1252 | //op1.m_taintdisable = true; | ||
1253 | //AddPhysicsActorTaint(p1); | ||
1254 | //} | ||
1255 | //if (op2.m_interpenetrationcount >= interpenetrations_before_disable) | ||
1256 | //{ | ||
1257 | // op2.m_taintdisable = true; | ||
1258 | //AddPhysicsActorTaint(p2); | ||
1259 | //} | ||
1260 | |||
1261 | //contact.depth = contact.depth / 8f; | ||
1262 | //contact.normal = new d.Vector3(0, 0, 1); | ||
1263 | //} | ||
1264 | //if (op1.m_disabled || op2.m_disabled) | ||
1265 | //{ | ||
1266 | //Manually disabled objects stay disabled | ||
1267 | //contact.depth = 0f; | ||
1268 | //} | ||
1269 | #endregion | ||
1270 | } | ||
1271 | */ | ||
1272 | #endregion | ||
1273 | if (curContact.depth >= 1.00f) | 1116 | if (curContact.depth >= 1.00f) |
1274 | { | 1117 | { |
1275 | //m_log.Info("[P]: " + contact.depth.ToString()); | 1118 | //m_log.Info("[P]: " + contact.depth.ToString()); |
@@ -1584,12 +1427,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1584 | } | 1427 | } |
1585 | else if (at == ActorTypes.Prim) | 1428 | else if (at == ActorTypes.Prim) |
1586 | { | 1429 | { |
1587 | //d.AABB aabb1 = new d.AABB(); | ||
1588 | //d.AABB aabb2 = new d.AABB(); | ||
1589 | |||
1590 | //d.GeomGetAABB(contactGeom.g2, out aabb2); | ||
1591 | //d.GeomGetAABB(contactGeom.g1, out aabb1); | ||
1592 | //aabb1. | ||
1593 | if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f))) | 1430 | if (((Math.Abs(contactGeom.normal.X - contact.normal.X) < 1.026f) && (Math.Abs(contactGeom.normal.Y - contact.normal.Y) < 0.303f) && (Math.Abs(contactGeom.normal.Z - contact.normal.Z) < 0.065f))) |
1594 | { | 1431 | { |
1595 | if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z) | 1432 | if (contactGeom.normal.X == contact.normal.X && contactGeom.normal.Y == contact.normal.Y && contactGeom.normal.Z == contact.normal.Z) |
@@ -1631,14 +1468,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1631 | cc1 = (OdeCharacter)p1; | 1468 | cc1 = (OdeCharacter)p1; |
1632 | obj2LocalID = cc1.LocalID; | 1469 | obj2LocalID = cc1.LocalID; |
1633 | cc1.AddCollisionEvent(cc2.LocalID, contact); | 1470 | cc1.AddCollisionEvent(cc2.LocalID, contact); |
1634 | //ctype = (int)CollisionCategories.Character; | ||
1635 | |||
1636 | //if (cc1.CollidingObj) | ||
1637 | //cStartStop = (int)StatusIndicators.Generic; | ||
1638 | //else | ||
1639 | //cStartStop = (int)StatusIndicators.Start; | ||
1640 | |||
1641 | //returncollisions = true; | ||
1642 | break; | 1471 | break; |
1643 | 1472 | ||
1644 | case ActorTypes.Prim: | 1473 | case ActorTypes.Prim: |
@@ -1648,21 +1477,11 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1648 | obj2LocalID = cp1.LocalID; | 1477 | obj2LocalID = cp1.LocalID; |
1649 | cp1.AddCollisionEvent(cc2.LocalID, contact); | 1478 | cp1.AddCollisionEvent(cc2.LocalID, contact); |
1650 | } | 1479 | } |
1651 | //ctype = (int)CollisionCategories.Geom; | ||
1652 | |||
1653 | //if (cp1.CollidingObj) | ||
1654 | //cStartStop = (int)StatusIndicators.Generic; | ||
1655 | //else | ||
1656 | //cStartStop = (int)StatusIndicators.Start; | ||
1657 | |||
1658 | //returncollisions = true; | ||
1659 | break; | 1480 | break; |
1660 | 1481 | ||
1661 | case ActorTypes.Ground: | 1482 | case ActorTypes.Ground: |
1662 | case ActorTypes.Unknown: | 1483 | case ActorTypes.Unknown: |
1663 | obj2LocalID = 0; | 1484 | obj2LocalID = 0; |
1664 | //ctype = (int)CollisionCategories.Land; | ||
1665 | //returncollisions = true; | ||
1666 | break; | 1485 | break; |
1667 | } | 1486 | } |
1668 | 1487 | ||
@@ -1684,13 +1503,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1684 | cc1 = (OdeCharacter) p1; | 1503 | cc1 = (OdeCharacter) p1; |
1685 | obj2LocalID = cc1.LocalID; | 1504 | obj2LocalID = cc1.LocalID; |
1686 | cc1.AddCollisionEvent(cp2.LocalID, contact); | 1505 | cc1.AddCollisionEvent(cp2.LocalID, contact); |
1687 | //ctype = (int)CollisionCategories.Character; | ||
1688 | |||
1689 | //if (cc1.CollidingObj) | ||
1690 | //cStartStop = (int)StatusIndicators.Generic; | ||
1691 | //else | ||
1692 | //cStartStop = (int)StatusIndicators.Start; | ||
1693 | //returncollisions = true; | ||
1694 | } | 1506 | } |
1695 | break; | 1507 | break; |
1696 | case ActorTypes.Prim: | 1508 | case ActorTypes.Prim: |
@@ -1700,23 +1512,12 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1700 | cp1 = (OdePrim) p1; | 1512 | cp1 = (OdePrim) p1; |
1701 | obj2LocalID = cp1.LocalID; | 1513 | obj2LocalID = cp1.LocalID; |
1702 | cp1.AddCollisionEvent(cp2.LocalID, contact); | 1514 | cp1.AddCollisionEvent(cp2.LocalID, contact); |
1703 | //ctype = (int)CollisionCategories.Geom; | ||
1704 | |||
1705 | //if (cp1.CollidingObj) | ||
1706 | //cStartStop = (int)StatusIndicators.Generic; | ||
1707 | //else | ||
1708 | //cStartStop = (int)StatusIndicators.Start; | ||
1709 | |||
1710 | //returncollisions = true; | ||
1711 | } | 1515 | } |
1712 | break; | 1516 | break; |
1713 | 1517 | ||
1714 | case ActorTypes.Ground: | 1518 | case ActorTypes.Ground: |
1715 | case ActorTypes.Unknown: | 1519 | case ActorTypes.Unknown: |
1716 | obj2LocalID = 0; | 1520 | obj2LocalID = 0; |
1717 | //ctype = (int)CollisionCategories.Land; | ||
1718 | |||
1719 | //returncollisions = true; | ||
1720 | break; | 1521 | break; |
1721 | } | 1522 | } |
1722 | 1523 | ||
@@ -1724,80 +1525,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
1724 | } | 1525 | } |
1725 | break; | 1526 | break; |
1726 | } | 1527 | } |
1727 | //if (returncollisions) | ||
1728 | //{ | ||
1729 | |||
1730 | //lock (m_storedCollisions) | ||
1731 | //{ | ||
1732 | //cDictKey = obj1LocalID.ToString() + obj2LocalID.ToString() + cStartStop.ToString() + ctype.ToString(); | ||
1733 | //if (m_storedCollisions.ContainsKey(cDictKey)) | ||
1734 | //{ | ||
1735 | //sCollisionData objd = m_storedCollisions[cDictKey]; | ||
1736 | //objd.NumberOfCollisions += 1; | ||
1737 | //objd.lastframe = framecount; | ||
1738 | //m_storedCollisions[cDictKey] = objd; | ||
1739 | //} | ||
1740 | //else | ||
1741 | //{ | ||
1742 | //sCollisionData objd = new sCollisionData(); | ||
1743 | //objd.ColliderLocalId = obj1LocalID; | ||
1744 | //objd.CollidedWithLocalId = obj2LocalID; | ||
1745 | //objd.CollisionType = ctype; | ||
1746 | //objd.NumberOfCollisions = 1; | ||
1747 | //objd.lastframe = framecount; | ||
1748 | //objd.StatusIndicator = cStartStop; | ||
1749 | //m_storedCollisions.Add(cDictKey, objd); | ||
1750 | //} | ||
1751 | //} | ||
1752 | // } | ||
1753 | } | 1528 | } |
1754 | /* | ||
1755 | private int TriArrayCallback(IntPtr trimesh, IntPtr refObject, int[] triangleIndex, int triCount) | ||
1756 | { | ||
1757 | String name1 = null; | ||
1758 | String name2 = null; | ||
1759 | |||
1760 | if (!geom_name_map.TryGetValue(trimesh, out name1)) | ||
1761 | { | ||
1762 | name1 = "null"; | ||
1763 | } | ||
1764 | if (!geom_name_map.TryGetValue(refObject, out name2)) | ||
1765 | { | ||
1766 | name2 = "null"; | ||
1767 | } | ||
1768 | |||
1769 | m_log.InfoFormat("TriArrayCallback: A collision was detected between {1} and {2}", 0, name1, name2); | ||
1770 | |||
1771 | return 1; | ||
1772 | } | ||
1773 | |||
1774 | private int TriCallback(IntPtr trimesh, IntPtr refObject, int triangleIndex) | ||
1775 | { | ||
1776 | // String name1 = null; | ||
1777 | // String name2 = null; | ||
1778 | // | ||
1779 | // if (!geom_name_map.TryGetValue(trimesh, out name1)) | ||
1780 | // { | ||
1781 | // name1 = "null"; | ||
1782 | // } | ||
1783 | // | ||
1784 | // if (!geom_name_map.TryGetValue(refObject, out name2)) | ||
1785 | // { | ||
1786 | // name2 = "null"; | ||
1787 | // } | ||
1788 | |||
1789 | // m_log.InfoFormat("TriCallback: A collision was detected between {1} and {2}. Index was {3}", 0, name1, name2, triangleIndex); | ||
1790 | |||
1791 | d.Vector3 v0 = new d.Vector3(); | ||
1792 | d.Vector3 v1 = new d.Vector3(); | ||
1793 | d.Vector3 v2 = new d.Vector3(); | ||
1794 | |||
1795 | d.GeomTriMeshGetTriangle(trimesh, 0, ref v0, ref v1, ref v2); | ||
1796 | // m_log.DebugFormat("Triangle {0} is <{1},{2},{3}>, <{4},{5},{6}>, <{7},{8},{9}>", triangleIndex, v0.X, v0.Y, v0.Z, v1.X, v1.Y, v1.Z, v2.X, v2.Y, v2.Z); | ||
1797 | |||
1798 | return 1; | ||
1799 | } | ||
1800 | */ | ||
1801 | /// <summary> | 1529 | /// <summary> |
1802 | /// This is our collision testing routine in ODE | 1530 | /// This is our collision testing routine in ODE |
1803 | /// </summary> | 1531 | /// </summary> |
@@ -2988,27 +2716,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
2988 | 2716 | ||
2989 | lock (OdeLock) | 2717 | lock (OdeLock) |
2990 | { | 2718 | { |
2991 | // Process 10 frames if the sim is running normal.. | 2719 | while (step_time > HalfOdeStep) |
2992 | // process 5 frames if the sim is running slow | ||
2993 | //try | ||
2994 | //{ | ||
2995 | //d.WorldSetQuickStepNumIterations(world, m_physicsiterations); | ||
2996 | //} | ||
2997 | //catch (StackOverflowException) | ||
2998 | //{ | ||
2999 | // m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); | ||
3000 | // ode.drelease(world); | ||
3001 | //base.TriggerPhysicsBasedRestart(); | ||
3002 | //} | ||
3003 | |||
3004 | // Figure out the Frames Per Second we're going at. | ||
3005 | //(step_time == 0.004f, there's 250 of those per second. Times the step time/step size | ||
3006 | |||
3007 | |||
3008 | // HACK: Using a time dilation of 1.0 to debug rubberbanding issues | ||
3009 | //m_timeDilation = Math.Min((step_time / ODE_STEPSIZE) / (0.09375f / ODE_STEPSIZE), 1.0f); | ||
3010 | |||
3011 | while (step_time > HalfOdeStep) | ||
3012 | { | 2720 | { |
3013 | try | 2721 | try |
3014 | { | 2722 | { |
@@ -3107,10 +2815,6 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3107 | tempTick = tempTick2; | 2815 | tempTick = tempTick2; |
3108 | } | 2816 | } |
3109 | 2817 | ||
3110 | //if ((framecount % m_randomizeWater) == 0) | ||
3111 | // randomizeWater(waterlevel); | ||
3112 | |||
3113 | //int RayCastTimeMS = m_rayCastManager.ProcessQueuedRequests(); | ||
3114 | m_rayCastManager.ProcessQueuedRequests(); | 2818 | m_rayCastManager.ProcessQueuedRequests(); |
3115 | 2819 | ||
3116 | if (CollectStats) | 2820 | if (CollectStats) |
@@ -3131,7 +2835,7 @@ namespace OpenSim.Region.PhysicsModule.ODE | |||
3131 | 2835 | ||
3132 | foreach (PhysicsActor obj in m_collisionEventActors.Values) | 2836 | foreach (PhysicsActor obj in m_collisionEventActors.Values) |
3133 | { | 2837 | { |
3134 | // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID); | 2838 | // m_log.DebugFormat("[PHYSICS]: Assessing {0} {1} for collision events", obj.SOPName, obj.LocalID); |
3135 | 2839 | ||
3136 | switch ((ActorTypes)obj.PhysicsActorType) | 2840 | switch ((ActorTypes)obj.PhysicsActorType) |
3137 | { | 2841 | { |