From 8bba8e232c98324a9462adf091af1877c5970fa2 Mon Sep 17 00:00:00 2001 From: Teravus Ovares Date: Sun, 9 Mar 2008 20:29:59 +0000 Subject: * Fixed a few things and enabling Physical Prim border crossings again. * Everyone try to push a physical prim across a region border now. --- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 22 +++-- OpenSim/Region/Physics/OdePlugin/OdePlugin.cs | 119 ++++++++++++++------------ 2 files changed, 75 insertions(+), 66 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index 179160f..c5ffe98 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -1721,16 +1721,20 @@ namespace OpenSim.Region.Physics.OdePlugin if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) { - base.RaiseOutOfBounds(_position); + //base.RaiseOutOfBounds(l_position); - //if (m_crossingfailures < 5) - //{ - //base.RequestPhysicsterseUpdate(); - //} - //else - //{ - //base.RaiseOutOfBounds(_position); - //} + if (m_crossingfailures < 5) + { + _position = l_position; + //_parent_scene.remActivePrim(this); + base.RequestPhysicsterseUpdate(); + return; + } + else + { + base.RaiseOutOfBounds(l_position); + return; + } } if (l_position.Z < 0) 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 // If the sim is running slow this frame, // don't process collision for prim! - if (timeStep < (m_SkipFramesAtms/3)) + //if (timeStep < (m_SkipFramesAtms/3)) + //{ + lock (_activeprims) { - lock (_activeprims) - { - foreach (OdePrim chr in _activeprims) + foreach (OdePrim chr in _activeprims) + { + // This if may not need to be there.. it might be skipped anyway. + if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) { - // This if may not need to be there.. it might be skipped anyway. - if (d.BodyIsEnabled(chr.Body) && (!chr.m_disabled)) - { - try - { - lock (chr) - { - if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0) - d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); - } - - } - catch (AccessViolationException) - { - m_log.Warn("[PHYSICS]: Unable to space collide"); - } - //calculateSpaceForGeom(chr.Position) - //foreach (OdePrim ch2 in _prims) - /// should be a separate space -- lots of avatars will be N**2 slow - //{ - //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body)) - //{ - // Only test prim that are 0.03 meters away in one direction. - // This should be Optimized! - - //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)) - //{ - //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback); - //} - //} - //} - } try { lock (chr) { - if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0) - d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); + if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false) + d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback); } + } catch (AccessViolationException) { m_log.Warn("[PHYSICS]: Unable to space collide"); } + //calculateSpaceForGeom(chr.Position) + //foreach (OdePrim ch2 in _prims) + /// should be a separate space -- lots of avatars will be N**2 slow + //{ + //if (ch2.IsPhysical && d.BodyIsEnabled(ch2.Body)) + //{ + // Only test prim that are 0.03 meters away in one direction. + // This should be Optimized! + + //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)) + //{ + //d.SpaceCollide2(chr.prim_geom, ch2.prim_geom, IntPtr.Zero, nearCallback); + //} + //} + //} } + //try + //{ + //lock (chr) + //{ + //if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0) + //d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); + //} + //} + //catch (AccessViolationException) + // { + //m_log.Warn("[PHYSICS]: Unable to space collide"); + //} } } - else - { - // Everything is going slow, so we're skipping object to object collisions - // At least collide test against the ground. - foreach (OdePrim chr in _activeprims) - { - // This if may not need to be there.. it might be skipped anyway. - if (d.BodyIsEnabled(chr.Body)) - { - // Collide test the prims with the terrain.. since if you don't do this, - // next frame, all of the physical prim in the scene will awaken and explode upwards - tmpSpace = calculateSpaceForGeom(chr.Position); - if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace)) - d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback); - d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); - } - } - } + #region disabled code + //} + //else + //{ + // Everything is going slow, so we're skipping object to object collisions + // At least collide test against the ground. + //foreach (OdePrim chr in _activeprims) + //{ + // This if may not need to be there.. it might be skipped anyway. + //if (d.BodyIsEnabled(chr.Body)) + //{ + // Collide test the prims with the terrain.. since if you don't do this, + // next frame, all of the physical prim in the scene will awaken and explode upwards + //tmpSpace = calculateSpaceForGeom(chr.Position); + //if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace)) + //d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback); + //d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); + //} + //} + //} + #endregion } #endregion @@ -870,7 +872,10 @@ namespace OpenSim.Region.Physics.OdePlugin public void remActivePrim(OdePrim deactivatePrim) { - _activeprims.Remove(deactivatePrim); + lock (_activeprims) + { + _activeprims.Remove(deactivatePrim); + } } public override void RemovePrim(PhysicsActor prim) -- cgit v1.1