Book Image

JMonkeyEngine 3.0 Cookbook

By : Rickard Eden
Book Image

JMonkeyEngine 3.0 Cookbook

By: Rickard Eden

Overview of this book

Table of Contents (17 chapters)
jMonkeyEngine 3.0 Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Adding Bullet physics to the application


This section provides a description of the basic steps to add bullet physics to an application.

In the simple InitApp method of the application, add the following lines of code:

BulletAppState bulletAppState = new BulletAppState();
stateManager.attach(bulletAppState);

To get a basic ground and some items to play with, add the following code:

PhysicsTestHelper.createPhysicsTestWorldSoccer(rootNode, assetManager, bulletAppState.getPhysicsSpace());

Objects that require physics should both be attached to the scene graph and have a RigidBodyControl object, which is added to physicsSpace of bulletAppState.