void IDuringForcesUpdateable.Update(float dt)
{
QueryAccelerator.GetEntries(boundingBox, broadPhaseEntries);
//TODO: Could integrate the entire thing into the collision detection pipeline. Applying forces
//in the collision detection pipeline isn't allowed, so there'd still need to be an Updateable involved.
//However, the broadphase query would be eliminated and the raycasting work would be automatically multithreaded.
this.dt = dt;
//Don't always multithread. For small numbers of objects, the overhead of using multithreading isn't worth it.
//Could tune this value depending on platform for better performance.
if (broadPhaseEntries.Count > 30 && ThreadManager.ThreadCount > 1)
ThreadManager.ForLoop(0, broadPhaseEntries.Count, analyzeCollisionEntryDelegate);
else
for (int i = 0; i < broadPhaseEntries.Count; i++)
{
AnalyzeEntry(i);
}
broadPhaseEntries.Clear();
}