Time for action – an elevator platform
Let's build a scene that uses all three types of physical objects: dynamic, static, and kinematic. The static part of the scene contains a floor (a horizontal box), a slope (a rotated box), and a wall (a vertical box). Later, we add a kinematic moving platform (a cuboid box) and a dynamic ball (a sphere), and then see how they interact.
- Make a copy of
Main.java
and name the classPhysicsKinematic.java
. Remember to also refactor the first line of themain()
method to the following:PhysicsKinematic app = new PhysicsKinematic();
- Make this a physical game by attaching a
BulletAppState
instance.private BulletAppState bulletAppState; @Override public void simpleInitApp() { bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); ...
Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.