still issues with volume detectors and sleeping bodies

httptests
UbitUmarov 2017-04-15 01:21:47 +01:00
parent 73be6cb269
commit 4f8f04d949
2 changed files with 41 additions and 23 deletions

View File

@ -1210,14 +1210,17 @@ namespace OpenSim.Region.PhysicsModule.ubOde
if (m_cureventsubscription < 50000) if (m_cureventsubscription < 50000)
m_cureventsubscription += timestep; m_cureventsubscription += timestep;
if(CollisionVDTCEventsThisFrame != null && CollisionVDTCEventsThisFrame.Count >0 && (Body == IntPtr.Zero || d.BodyIsEnabled(Body)))
CollisionVDTCEventsThisFrame.Clear();
if (m_cureventsubscription < m_eventsubscription)
return;
if (CollisionEventsThisFrame == null) if (CollisionEventsThisFrame == null)
return; return;
int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count; int ncolisions = CollisionEventsThisFrame.m_objCollisionList.Count;
if (m_cureventsubscription < m_eventsubscription)
return;
if (!SentEmptyCollisionsEvent || ncolisions > 0) if (!SentEmptyCollisionsEvent || ncolisions > 0)
{ {
base.SendCollisionUpdate(CollisionEventsThisFrame); base.SendCollisionUpdate(CollisionEventsThisFrame);
@ -1234,8 +1237,6 @@ namespace OpenSim.Region.PhysicsModule.ubOde
CollisionEventsThisFrame.Clear(); CollisionEventsThisFrame.Clear();
} }
} }
if(CollisionVDTCEventsThisFrame != null && (Body == IntPtr.Zero || d.BodyIsEnabled(Body)))
CollisionVDTCEventsThisFrame.Clear();
} }
public override bool SubscribedEvents() public override bool SubscribedEvents()
@ -2938,7 +2939,8 @@ namespace OpenSim.Region.PhysicsModule.ubOde
{ {
d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z); d.GeomSetPosition(prim_geom, newPos.X, newPos.Y, newPos.Z);
_position = newPos; _position = newPos;
m_bodyMoveCoolDown = -5; if (Body != IntPtr.Zero && !m_disabled)
m_bodyMoveCoolDown = -5;
} }
if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body)) if (Body != IntPtr.Zero && !d.BodyIsEnabled(Body))
{ {

View File

@ -1668,11 +1668,15 @@ namespace OpenSim.Region.PhysicsModule.ubOde
// d.WorldSetQuickStepNumIterations(world, curphysiteractions); // d.WorldSetQuickStepNumIterations(world, curphysiteractions);
int loopstartMS = Util.EnvironmentTickCount(); double loopstartMS = Util.GetTimeStampMS();
int looptimeMS = 0; double looptimeMS = 0;
int changestimeMS = 0; double changestimeMS = 0;
int maxChangestime = (int)(reqTimeStep * 500f); // half the time double maxChangestime = (int)(reqTimeStep * 500f); // half the time
int maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time double maxLoopTime = (int)(reqTimeStep * 1200f); // 1.2 the time
// double collisionTime = 0;
// double qstepTIme = 0;
// double tmpTime = 0;
d.AllocateODEDataForThread(~0U); d.AllocateODEDataForThread(~0U);
@ -1695,7 +1699,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
item.actor.Name, item.what.ToString()); item.actor.Name, item.what.ToString());
} }
} }
changestimeMS = Util.EnvironmentTickCountSubtract(loopstartMS); changestimeMS = Util.GetTimeStampMS() - loopstartMS;
if (changestimeMS > maxChangestime) if (changestimeMS > maxChangestime)
break; break;
} }
@ -1740,9 +1744,19 @@ namespace OpenSim.Region.PhysicsModule.ubOde
m_rayCastManager.ProcessQueuedRequests(); m_rayCastManager.ProcessQueuedRequests();
// tmpTime = Util.GetTimeStampMS();
collision_optimized(); collision_optimized();
List<OdePrim> sleepers = new List<OdePrim>(); // collisionTime += Util.GetTimeStampMS() - tmpTime;
lock(_collisionEventPrimRemove)
{
foreach (PhysicsActor obj in _collisionEventPrimRemove)
_collisionEventPrim.Remove(obj);
_collisionEventPrimRemove.Clear();
}
List<OdePrim> sleepers = new List<OdePrim>();
foreach (PhysicsActor obj in _collisionEventPrim) foreach (PhysicsActor obj in _collisionEventPrim)
{ {
if (obj == null) if (obj == null)
@ -1773,17 +1787,11 @@ namespace OpenSim.Region.PhysicsModule.ubOde
prm.SleeperAddCollisionEvents(); prm.SleeperAddCollisionEvents();
sleepers.Clear(); sleepers.Clear();
lock(_collisionEventPrimRemove)
{
foreach (PhysicsActor obj in _collisionEventPrimRemove)
_collisionEventPrim.Remove(obj);
_collisionEventPrimRemove.Clear();
}
// do a ode simulation step // do a ode simulation step
// tmpTime = Util.GetTimeStampMS();
d.WorldQuickStep(world, ODE_STEPSIZE); d.WorldQuickStep(world, ODE_STEPSIZE);
d.JointGroupEmpty(contactgroup); d.JointGroupEmpty(contactgroup);
// qstepTIme += Util.GetTimeStampMS() - tmpTime;
// update managed ideia of physical data and do updates to core // update managed ideia of physical data and do updates to core
/* /*
@ -1824,7 +1832,7 @@ namespace OpenSim.Region.PhysicsModule.ubOde
step_time -= ODE_STEPSIZE; step_time -= ODE_STEPSIZE;
nodeframes++; nodeframes++;
looptimeMS = Util.EnvironmentTickCountSubtract(loopstartMS); looptimeMS = Util.GetTimeStampMS() - loopstartMS;
if (looptimeMS > maxLoopTime) if (looptimeMS > maxLoopTime)
break; break;
} }
@ -1892,6 +1900,14 @@ namespace OpenSim.Region.PhysicsModule.ubOde
int totgeoms = nstaticgeoms + nactivegeoms + ngroundgeoms + 1; // one ray int totgeoms = nstaticgeoms + nactivegeoms + ngroundgeoms + 1; // one ray
int nbodies = d.NTotalBodies; int nbodies = d.NTotalBodies;
int ngeoms = d.NTotalGeoms; int ngeoms = d.NTotalGeoms;
*/
/*
looptimeMS /= nodeframes;
if(looptimeMS > 0.080)
{
collisionTime /= nodeframes;
qstepTIme /= nodeframes;
}
*/ */
// Finished with all sim stepping. If requested, dump world state to file for debugging. // Finished with all sim stepping. If requested, dump world state to file for debugging.
// TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed? // TODO: This call to the export function is already inside lock (OdeLock) - but is an extra lock needed?