aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
authorTeravus Ovares2008-05-01 00:54:21 +0000
committerTeravus Ovares2008-05-01 00:54:21 +0000
commit1d9c68969e2b2f5ca40dd318fd6cd27ef0b84a83 (patch)
tree83e8a5377509fc82b8efef29ce0c9c63b5f5080e /OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
parent* Whoops, SQLite land data malfunction. Fixed. (diff)
downloadopensim-SC_OLD-1d9c68969e2b2f5ca40dd318fd6cd27ef0b84a83.zip
opensim-SC_OLD-1d9c68969e2b2f5ca40dd318fd6cd27ef0b84a83.tar.gz
opensim-SC_OLD-1d9c68969e2b2f5ca40dd318fd6cd27ef0b84a83.tar.bz2
opensim-SC_OLD-1d9c68969e2b2f5ca40dd318fd6cd27ef0b84a83.tar.xz
* ODE Tweak. See if this helps.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs94
1 files changed, 23 insertions, 71 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index c346960..02b5628 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -377,7 +377,7 @@ namespace OpenSim.Region.Physics.OdePlugin
377 int count = 0; 377 int count = 0;
378 try 378 try
379 { 379 {
380 //m_log.Warn(g1.ToString() + "|" + g2.ToString()); 380
381 // Colliding Geom To Geom 381 // Colliding Geom To Geom
382 // This portion of the function 'was' blatantly ripped off from BoxStack.cs 382 // This portion of the function 'was' blatantly ripped off from BoxStack.cs
383 383
@@ -392,10 +392,7 @@ namespace OpenSim.Region.Physics.OdePlugin
392 392
393 lock (contacts) 393 lock (contacts)
394 { 394 {
395 //if (g1 == (IntPtr)0) 395
396 //m_log.Info("g1=0");
397 //if (g2 == (IntPtr)0)
398 //m_log.Info("g2=0");
399 396
400 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf); 397 count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
401 } 398 }
@@ -435,8 +432,8 @@ namespace OpenSim.Region.Physics.OdePlugin
435 // We only need to test p2 for 'jump crouch purposes' 432 // We only need to test p2 for 'jump crouch purposes'
436 p2.IsColliding = true; 433 p2.IsColliding = true;
437 434
438 if ((framecount % m_returncollisions) == 0) 435 //if ((framecount % m_returncollisions) == 0)
439 collision_accounting_events(p1, p2); 436 //collision_accounting_events(p1, p2);
440 437
441 438
442 switch (p1.PhysicsActorType) 439 switch (p1.PhysicsActorType)
@@ -903,16 +900,13 @@ namespace OpenSim.Region.Physics.OdePlugin
903 } 900 }
904 901
905 902
906 // If the sim is running slow this frame, 903
907 // don't process collision for prim!
908 //if (timeStep < (m_SkipFramesAtms/3))
909 //{
910 lock (_activeprims) 904 lock (_activeprims)
911 { 905 {
912 906
913 foreach (OdePrim chr in _activeprims) 907 foreach (OdePrim chr in _activeprims)
914 { 908 {
915 // This if may not need to be there.. it might be skipped anyway. 909
916 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) 910 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
917 { 911 {
918 try 912 try
@@ -921,6 +915,8 @@ namespace OpenSim.Region.Physics.OdePlugin
921 { 915 {
922 if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false) 916 if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false)
923 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); 917 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
918 else
919 m_log.Debug("[PHYSICS]: unable to collide test active prim against space. The space was zero, the geom was zero or it was in the process of being removed");
924 } 920 }
925 921
926 } 922 }
@@ -928,57 +924,12 @@ namespace OpenSim.Region.Physics.OdePlugin
928 { 924 {
929 m_log.Warn("[PHYSICS]: Unable to space collide"); 925 m_log.Warn("[PHYSICS]: Unable to space collide");
930 } 926 }
931 //calculateSpaceForGeom(chr.Position) 927
932 //foreach (OdePrim ch2 in _prims)
933 /// should be a separate space -- lots of avatars will be N**2 slow
934 //{
935 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body))
936 //{
937 // Only test prim that are 0.03 meters away in one direction.
938 // This should be Optimized!
939
940 //if ((Math.Abs(ch2.Position.X - chr.Position.X) < 0.03) || (Math.Abs(ch2.Position.Y - chr.Position.Y) < 0.03) || (Math.Abs(ch2.Position.X - chr.Position.X) < 0.03))
941 //{
942 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback);
943 //}
944 //}
945 //}
946 } 928 }
947 //try 929
948 //{
949 //lock (chr)
950 //{
951 //if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
952 //d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
953 //}
954 //}
955 //catch (AccessViolationException)
956 // {
957 //m_log.Warn("[PHYSICS]: Unable to space collide");
958 //}
959 } 930 }
960 } 931 }
961 #region disabled code 932
962 //}
963 //else
964 //{
965 // Everything is going slow, so we're skipping object to object collisions
966 // At least collide test against the ground.
967 //foreach (OdePrim chr in _activeprims)
968 //{
969 // This if may not need to be there.. it might be skipped anyway.
970 //if (d.BodyIsEnabled(chr.Body))
971 //{
972 // Collide test the prims with the terrain.. since if you don't do this,
973 // next frame, all of the physical prim in the scene will awaken and explode upwards
974 //tmpSpace = calculateSpaceForGeom(chr.Position);
975 //if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace))
976 //d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback);
977 //d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
978 //}
979 //}
980 //}
981 #endregion
982 } 933 }
983 934
984 #endregion 935 #endregion
@@ -1006,6 +957,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1006 { 957 {
1007 lock (OdeLock) 958 lock (OdeLock)
1008 { 959 {
960 m_log.Debug("[PHYSICS]:ODELOCK");
1009 ((OdeCharacter) actor).Destroy(); 961 ((OdeCharacter) actor).Destroy();
1010 _characters.Remove((OdeCharacter) actor); 962 _characters.Remove((OdeCharacter) actor);
1011 } 963 }
@@ -1524,16 +1476,16 @@ namespace OpenSim.Region.Physics.OdePlugin
1524 { 1476 {
1525 // Process 10 frames if the sim is running normal.. 1477 // Process 10 frames if the sim is running normal..
1526 // process 5 frames if the sim is running slow 1478 // process 5 frames if the sim is running slow
1527 try 1479 //try
1528 { 1480 //{
1529 d.WorldSetQuickStepNumIterations(world, m_physicsiterations); 1481 //d.WorldSetQuickStepNumIterations(world, m_physicsiterations);
1530 } 1482 //}
1531 catch (StackOverflowException) 1483 //catch (StackOverflowException)
1532 { 1484 //{
1533 m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim."); 1485 // m_log.Error("[PHYSICS]: The operating system wasn't able to allocate enough memory for the simulation. Restarting the sim.");
1534 ode.drelease(world); 1486 // ode.drelease(world);
1535 base.TriggerPhysicsBasedRestart(); 1487 //base.TriggerPhysicsBasedRestart();
1536 } 1488 //}
1537 1489
1538 int i = 0; 1490 int i = 0;
1539 1491
@@ -1602,7 +1554,7 @@ namespace OpenSim.Region.Physics.OdePlugin
1602 d.WorldQuickStep(world, ODE_STEPSIZE); 1554 d.WorldQuickStep(world, ODE_STEPSIZE);
1603 1555
1604 d.JointGroupEmpty(contactgroup); 1556 d.JointGroupEmpty(contactgroup);
1605 ode.dunlock(world); 1557 //ode.dunlock(world);
1606 } 1558 }
1607 catch (Exception e) 1559 catch (Exception e)
1608 { 1560 {