ODE Plugin

* More cleanup
* Less noise
0.6.0-stable
Teravus Ovares 2008-03-09 17:50:24 +00:00
parent 9bc6ee576e
commit 7cae577094
2 changed files with 75 additions and 56 deletions

View File

@ -739,7 +739,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
else
{
m_log.Error("[PHYISCS]: The scene reused a disposed PhysActor! *waves finger*, Don't be evil.");
m_log.Error("[PHYSICS]: The scene reused a disposed PhysActor! *waves finger*, Don't be evil.");
}
}

View File

@ -119,7 +119,7 @@ namespace OpenSim.Region.Physics.OdePlugin
private List<OdePrim> _taintedPrim = new List<OdePrim>();
public Dictionary<IntPtr, String> geom_name_map = new Dictionary<IntPtr, String>();
public Dictionary<IntPtr, PhysicsActor> actor_name_map = new Dictionary<IntPtr, PhysicsActor>();
private d.ContactGeom[] contacts = new d.ContactGeom[30];
private d.ContactGeom[] contacts = new d.ContactGeom[80];
private d.Contact contact;
private d.Contact TerrainContact;
private d.Contact AvatarMovementprimContact;
@ -293,22 +293,12 @@ namespace OpenSim.Region.Physics.OdePlugin
}
// Colliding Geom To Geom
// This portion of the function 'was' blatantly ripped off from BoxStack.cs
if (g1 == (IntPtr)0 || g2 == (IntPtr)0)
return;
IntPtr b1 = d.GeomGetBody(g1);
IntPtr b2 = d.GeomGetBody(g2);
if (g1 == g2)
return; // Can't collide with yourself
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
return;
d.GeomClassID id = d.GeomGetClass(g1);
String name1 = null;
@ -334,8 +324,28 @@ namespace OpenSim.Region.Physics.OdePlugin
try
{
//m_log.Warn(g1.ToString() + "|" + g2.ToString());
// Colliding Geom To Geom
// This portion of the function 'was' blatantly ripped off from BoxStack.cs
if (g1 == g2)
return; // Can't collide with yourself
if (b1 != IntPtr.Zero && b2 != IntPtr.Zero && d.AreConnectedExcluding(b1, b2, d.JointType.Contact))
return;
lock (contacts)
{
if (g1 == (IntPtr)0)
m_log.Info("g1=0");
if (g2 == (IntPtr)0)
m_log.Info("g2=0");
count = d.Collide(g1, g2, contacts.GetLength(0), contacts, d.ContactGeom.SizeOf);
}
}
catch (SEHException)
{
m_log.Error("[PHYSICS]: The Operating system shut down ODE because of corrupt memory. This could be a result of really irregular terrain. If this repeats continuously, restart using Basic Physics and terrain fill your terrain. Restarting the sim.");
@ -686,6 +696,9 @@ namespace OpenSim.Region.Physics.OdePlugin
// don't process collision for prim!
if (timeStep < (m_SkipFramesAtms/3))
{
lock (_activeprims)
{
foreach (OdePrim chr in _activeprims)
{
// This if may not need to be there.. it might be skipped anyway.
@ -693,8 +706,11 @@ namespace OpenSim.Region.Physics.OdePlugin
{
try
{
lock (chr)
{
if (space != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
d.SpaceCollide2(space, chr.prim_geom, IntPtr.Zero, nearCallback);
}
}
catch (AccessViolationException)
@ -721,6 +737,7 @@ namespace OpenSim.Region.Physics.OdePlugin
{
lock (chr)
{
if (LandGeom != (IntPtr)0 && chr.prim_geom != (IntPtr)0)
d.SpaceCollide2(LandGeom, chr.prim_geom, IntPtr.Zero, nearCallback);
}
}
@ -730,6 +747,7 @@ namespace OpenSim.Region.Physics.OdePlugin
}
}
}
}
else
{
// Everything is going slow, so we're skipping object to object collisions
@ -1015,11 +1033,11 @@ namespace OpenSim.Region.Physics.OdePlugin
System.Threading.Thread.Sleep(20);
if (currentspace != space)
{
m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString());
if (currentspace == (IntPtr) 0)
{
int adfadf = 0;
}
//m_log.Info("[SPACE]: C:" + currentspace.ToString() + " g:" + geom.ToString());
//if (currentspace == (IntPtr) 0)
//{
//int adfadf = 0;
//}
if (d.SpaceQuery(currentspace, geom) && currentspace != (IntPtr) 0)
{
if (d.GeomIsSpace(currentspace))
@ -1328,9 +1346,10 @@ namespace OpenSim.Region.Physics.OdePlugin
{
RemovePrimThreadLocked(prim);
}
else
{
prim.ProcessTaints(timeStep);
}
processedtaints = true;
prim.m_collisionscore = 0;
}