aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/Physics/OdePlugin/OdePlugin.cs')
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs119
1 files changed, 62 insertions, 57 deletions
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index df3555f..16c6bb0 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -694,78 +694,80 @@ namespace OpenSim.Region.Physics.OdePlugin
694 694
695 // If the sim is running slow this frame, 695 // If the sim is running slow this frame,
696 // don't process collision for prim! 696 // don't process collision for prim!
697 if (timeStep < (m_SkipFramesAtms/3)) 697 //if (timeStep < (m_SkipFramesAtms/3))
698 //{
699 lock (_activeprims)
698 { 700 {
699 lock (_activeprims)
700 {
701 701
702 foreach (OdePrim chr in _activeprims) 702 foreach (OdePrim chr in _activeprims)
703 {
704 // This if may not need to be there.. it might be skipped anyway.
705 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
703 { 706 {
704 // This if may not need to be there.. it might be skipped anyway.
705 if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled))
706 {
707 try
708 {
709 lock (chr)
710 {
711 if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
712 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
713 }
714
715 }
716 catch (AccessViolationException)
717 {
718 m_log.Warn("[PHYSICS]: Unable to space collide");
719 }
720 //calculateSpaceForGeom(chr.Position)
721 //foreach (OdePrim ch2 in _prims)
722 /// should be a separate space -- lots of avatars will be N**2 slow
723 //{
724 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body))
725 //{
726 // Only test prim that are 0.03 meters away in one direction.
727 // This should be Optimized!
728
729 //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))
730 //{
731 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback);
732 //}
733 //}
734 //}
735 }
736 try 707 try
737 { 708 {
738 lock (chr) 709 lock (chr)
739 { 710 {
740 if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0) 711 if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false)
741 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); 712 d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
742 } 713 }
714
743 } 715 }
744 catch (AccessViolationException) 716 catch (AccessViolationException)
745 { 717 {
746 m_log.Warn("[PHYSICS]: Unable to space collide"); 718 m_log.Warn("[PHYSICS]: Unable to space collide");
747 } 719 }
720 //calculateSpaceForGeom(chr.Position)
721 //foreach (OdePrim ch2 in _prims)
722 /// should be a separate space -- lots of avatars will be N**2 slow
723 //{
724 //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body))
725 //{
726 // Only test prim that are 0.03 meters away in one direction.
727 // This should be Optimized!
728
729 //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))
730 //{
731 //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback);
732 //}
733 //}
734 //}
748 } 735 }
736 //try
737 //{
738 //lock (chr)
739 //{
740 //if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
741 //d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
742 //}
743 //}
744 //catch (AccessViolationException)
745 // {
746 //m_log.Warn("[PHYSICS]: Unable to space collide");
747 //}
749 } 748 }
750 } 749 }
751 else 750 #region disabled code
752 { 751 //}
753 // Everything is going slow, so we're skipping object to object collisions 752 //else
754 // At least collide test against the ground. 753 //{
755 foreach (OdePrim chr in _activeprims) 754 // Everything is going slow, so we're skipping object to object collisions
756 { 755 // At least collide test against the ground.
757 // This if may not need to be there.. it might be skipped anyway. 756 //foreach (OdePrim chr in _activeprims)
758 if (d.BodyIsEnabled(chr.Body)) 757 //{
759 { 758 // This if may not need to be there.. it might be skipped anyway.
760 // Collide test the prims with the terrain.. since if you don't do this, 759 //if (d.BodyIsEnabled(chr.Body))
761 // next frame, all of the physical prim in the scene will awaken and explode upwards 760 //{
762 tmpSpace = calculateSpaceForGeom(chr.Position); 761 // Collide test the prims with the terrain.. since if you don't do this,
763 if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace)) 762 // next frame, all of the physical prim in the scene will awaken and explode upwards
764 d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback); 763 //tmpSpace = calculateSpaceForGeom(chr.Position);
765 d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); 764 //if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace))
766 } 765 //d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback);
767 } 766 //d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
768 } 767 //}
768 //}
769 //}
770 #endregion
769 } 771 }
770 772
771 #endregion 773 #endregion
@@ -870,7 +872,10 @@ namespace OpenSim.Region.Physics.OdePlugin
870 872
871 public void remActivePrim(OdePrim deactivatePrim) 873 public void remActivePrim(OdePrim deactivatePrim)
872 { 874 {
873 _activeprims.Remove(deactivatePrim); 875 lock (_activeprims)
876 {
877 _activeprims.Remove(deactivatePrim);
878 }
874 } 879 }
875 880
876 public override void RemovePrim(PhysicsActor prim) 881 public override void RemovePrim(PhysicsActor prim)