June 2013
Beginner
352 pages
9h 5m
English
We want the platform to go down after the ball rolls off, but currently, the ball doesn't have enough momentum to roll off by itself. Let's give it a little push.
PhysicsKinematic.java again and make it implement the PhysicsTickListener interface.public class PhysicsKinematic extends SimpleApplication
implements PhysicsCollisionListener, PhysicsTickListener {…}prePhysicsTick() and physicsTick(). Use the prePhysicsTick() method to apply a pushing force on the ball when the platform reaches the top floor.public void prePhysicsTick(PhysicsSpace space, float tpf) { if (isBallOnPlatform && isPlatformOnTop) { ballPhy.applyImpulse(new Vector3f(2, 0, 0), ...Read now
Unlock full access