public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } };
public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } };
/** * Allocate the physics space and start physics for ThreadingType.PARALLEL. * * @return true if successful, otherwise false */ private boolean startPhysicsOnExecutor() { if (executor != null) { executor.shutdown(); } executor = new ScheduledThreadPoolExecutor(1); final BulletAppState app = this; Callable<Boolean> call = new Callable<Boolean>() { public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } }; try { return executor.submit(call).get(); } catch (InterruptedException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (ExecutionException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } } private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {
/** * Allocate the physics space and start physics for ThreadingType.PARALLEL. * * @return true if successful, otherwise false */ private boolean startPhysicsOnExecutor() { if (executor != null) { executor.shutdown(); } executor = new ScheduledThreadPoolExecutor(1); final BulletAppState app = this; Callable<Boolean> call = new Callable<Boolean>() { public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } }; try { return executor.submit(call).get(); } catch (InterruptedException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (ExecutionException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } } private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {
/** * Allocate a physics space and start physics. * <p> * Physics starts automatically after the state is attached. To start it * sooner, invoke this method. */ public void startPhysics() { if (initialized) { return; } switch (threadingType) { case PARALLEL: boolean success = startPhysicsOnExecutor(); assert success; assert pSpace != null; break; case SEQUENTIAL: pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(this); break; default: throw new IllegalStateException(threadingType.toString()); } initialized = true; }
/** * Allocate a physics space and start physics. * <p> * Physics starts automatically after the state is attached. To start it * sooner, invoke this method. */ public void startPhysics() { if (initialized) { return; } switch (threadingType) { case PARALLEL: boolean success = startPhysicsOnExecutor(); assert success; assert pSpace != null; break; case SEQUENTIAL: pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(this); break; default: throw new IllegalStateException(threadingType.toString()); } initialized = true; }
public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } };
public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } };
public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } };
private boolean startPhysicsOnExecutor() { if (executor != null) { executor.shutdown(); } executor = new ScheduledThreadPoolExecutor(1); final BulletAppState app = this; Callable<Boolean> call = new Callable<Boolean>() { public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } }; try { return executor.submit(call).get(); } catch (InterruptedException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (ExecutionException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } } private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {
private boolean startPhysicsOnExecutor() { if (executor != null) { executor.shutdown(); } executor = new ScheduledThreadPoolExecutor(1); final BulletAppState app = this; Callable<Boolean> call = new Callable<Boolean>() { public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } }; try { return executor.submit(call).get(); } catch (InterruptedException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (ExecutionException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } } private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {
/** * Allocate the physics space and start physics for ThreadingType.PARALLEL. * * @return true if successful, otherwise false */ private boolean startPhysicsOnExecutor() { if (executor != null) { executor.shutdown(); } executor = new ScheduledThreadPoolExecutor(1); final BulletAppState app = this; Callable<Boolean> call = new Callable<Boolean>() { public Boolean call() throws Exception { detachedPhysicsLastUpdate = System.currentTimeMillis(); pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(app); return true; } }; try { return executor.submit(call).get(); } catch (InterruptedException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } catch (ExecutionException ex) { Logger.getLogger(BulletAppState.class.getName()).log(Level.SEVERE, null, ex); return false; } } private Callable<Boolean> parallelPhysicsUpdate = new Callable<Boolean>() {
/** * The physics system is started automatically on attaching, if you want to start it * before for some reason, you can use this method. */ public void startPhysics() { //start physics thread(pool) if (threadingType == ThreadingType.PARALLEL) { startPhysicsOnExecutor(); // } else if (threadingType == ThreadingType.DETACHED) { // startPhysicsOnExecutor(); // executor.submit(detachedPhysicsUpdate); } else { pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); } pSpace.addTickListener(this); initialized = true; }
/** * The physics system is started automatically on attaching, if you want to * start it before for some reason, you can use this method. */ public void startPhysics() { if (initialized) { return; } //start physics thread(pool) if (threadingType == ThreadingType.PARALLEL) { startPhysicsOnExecutor(); } else { pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); } pSpace.addTickListener(this); initialized = true; }
/** * Allocate a physics space and start physics. * <p> * Physics starts automatically after the state is attached. To start it * sooner, invoke this method. */ public void startPhysics() { if (initialized) { return; } switch (threadingType) { case PARALLEL: boolean success = startPhysicsOnExecutor(); assert success; assert pSpace != null; break; case SEQUENTIAL: pSpace = new PhysicsSpace(worldMin, worldMax, broadphaseType); pSpace.addTickListener(this); break; default: throw new IllegalStateException(threadingType.toString()); } initialized = true; }
public PMDPhysicsWorld() { float dist = 400f; physicsSpace = new PhysicsSpace( new Vector3f(-dist, -dist, -dist), new Vector3f(dist, dist, dist), PhysicsSpace.BroadphaseType.AXIS_SWEEP_3); // physicsSpace.setGravity(new Vector3f(0f, -9.8f * 2*2*2, 20f)); // physicsSpace.setGravity(new Vector3f(0f, -9.8f * 2, 0f)); physicsSpace.setGravity(new Vector3f(0f, -9.8f * 1f, 0f)); // physicsSpace.create(); // physicsSpace.update(dist, 1); physicsSpace.setAccuracy(accuracy); }