* Fixed a few things and enabling Physical Prim border crossings again.

* Everyone try to push a physical prim across a region border now.
0.6.0-stable
Teravus Ovares 2008-03-09 20:29:59 +00:00
parent f89e7107bb
commit 8bba8e232c
2 changed files with 75 additions and 66 deletions

View File

@ -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) 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) if (m_crossingfailures < 5)
//{ {
//base.RequestPhysicsterseUpdate(); _position = l_position;
//} //_parent_scene.remActivePrim(this);
//else base.RequestPhysicsterseUpdate();
//{ return;
//base.RaiseOutOfBounds(_position); }
//} else
{
base.RaiseOutOfBounds(l_position);
return;
}
} }
if (l_position.Z < 0) if (l_position.Z < 0)

View File

@ -694,78 +694,80 @@ namespace OpenSim.Region.Physics.OdePlugin
// If the sim is running slow this frame, // If the sim is running slow this frame,
// don't process collision for prim! // 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)
{ {
// This if may not need to be there.. it might be skipped anyway.
foreach (OdePrim chr in _activeprims) 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 try
{ {
lock (chr) lock (chr)
{ {
if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0) if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0 && chr.m_taintremove == false)
d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
} }
} }
catch (AccessViolationException) catch (AccessViolationException)
{ {
m_log.Warn("[PHYSICS]: Unable to space collide"); 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 #region disabled code
{ //}
// Everything is going slow, so we're skipping object to object collisions //else
// At least collide test against the ground. //{
foreach (OdePrim chr in _activeprims) // Everything is going slow, so we're skipping object to object collisions
{ // At least collide test against the ground.
// This if may not need to be there.. it might be skipped anyway. //foreach (OdePrim chr in _activeprims)
if (d.BodyIsEnabled(chr.Body)) //{
{ // This if may not need to be there.. it might be skipped anyway.
// Collide test the prims with the terrain.. since if you don't do this, //if (d.BodyIsEnabled(chr.Body))
// next frame, all of the physical prim in the scene will awaken and explode upwards //{
tmpSpace = calculateSpaceForGeom(chr.Position); // Collide test the prims with the terrain.. since if you don't do this,
if (tmpSpace != (IntPtr) 0 && d.GeomIsSpace(tmpSpace)) // next frame, all of the physical prim in the scene will awaken and explode upwards
d.SpaceCollide2(calculateSpaceForGeom(chr.Position), chr.prim_geom, IntPtr.Zero, nearCallback); //tmpSpace = calculateSpaceForGeom(chr.Position);
d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback); //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 #endregion
@ -870,7 +872,10 @@ namespace OpenSim.Region.Physics.OdePlugin
public void remActivePrim(OdePrim deactivatePrim) public void remActivePrim(OdePrim deactivatePrim)
{ {
_activeprims.Remove(deactivatePrim); lock (_activeprims)
{
_activeprims.Remove(deactivatePrim);
}
} }
public override void RemovePrim(PhysicsActor prim) public override void RemovePrim(PhysicsActor prim)