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.

Get jMonkeyEngine 3.0 Beginner's Guide now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.