Fix bullet skipping enqueued tasks - #867

v3.2
Riccardo Balbo 7 years ago committed by Stephen Gold
parent f3351256cb
commit 45e7b4c6ed
  1. 13
      jme3-bullet/src/main/java/com/jme3/bullet/PhysicsSpace.java

@ -193,19 +193,16 @@ public class PhysicsSpace {
private native long createPhysicsSpace(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int broadphaseType, boolean threading); private native long createPhysicsSpace(float minX, float minY, float minZ, float maxX, float maxY, float maxZ, int broadphaseType, boolean threading);
private void preTick_native(float f) { private void preTick_native(float f) {
AppTask task = pQueue.poll(); AppTask task;
task = pQueue.poll(); while((task=pQueue.poll())!=null){
while (task != null) { if(task.isCancelled())continue;
while (task.isCancelled()) { try{
task = pQueue.poll();
}
try {
task.invoke(); task.invoke();
} catch (Exception ex) { } catch (Exception ex) {
logger.log(Level.SEVERE, null, ex); logger.log(Level.SEVERE, null, ex);
} }
task = pQueue.poll();
} }
for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) { for (Iterator<PhysicsTickListener> it = tickListeners.iterator(); it.hasNext();) {
PhysicsTickListener physicsTickCallback = it.next(); PhysicsTickListener physicsTickCallback = it.next();
physicsTickCallback.prePhysicsTick(this, f); physicsTickCallback.prePhysicsTick(this, f);

Loading…
Cancel
Save