My whole world is falling apart

A physics simulation can be quite a loose cannon. Don't be surprised when physical objects jitter or are unceremoniously hurled out of the scene. Congratulations, you have created a physically impossible state! Most likely, you positioned two solid objects too close to each other. How do you find the source of the problem?

  • Activate the physics debug mode to visualize the actual collision shapes. Some dynamic objects receive HullCollisionShapes by default, which are not mesh-accurate. Make certain that no collision shapes overlap. You can render the (otherwise invisible) collision shapes as wireframes with the following command:
    bulletAppState.getPhysicsSpace().enableDebug(assetManager); // on
    bulletAppState.getPhysicsSpace().disableDebug() ...

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.