O'Reilly logo

jMonkeyEngine 3.0 Beginner's Guide by Ruth Kusterer

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – first-person navigation

One of the reasons why you extend SimpleApplication is that basic camera navigation (WASD keys and MouseLook) is already preconfigured. But when you run the PhysicsTown sample, you notice that the first-person camera keeps running straight through walls. Have we not just added a RigidBodyControl to the model to make the town solid?

We have, but the camera is not a solid object yet. The default navigation of SimpleApplication uses the non-physical setLocalTranslation() method to move the camera. To make this sample work, we first need to define a so-called collision shape for the invisible player, since the camera object has no mesh. We also update the keyboard navigation to use physics-aware methods.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required