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

Creating a reusable character control


To start off the chapter, we will create a class that we can use for various character-controlled purposes. The example describes an FPS character, but the method is the same for any player-controlled character.

The Control class we'll build will be based on BetterCharacterControl. It might be a good idea to have a look at the class or the TestBetterCharacter example from the jMonkeyEngine test package if you want to find out how this works. Another good starting point would be the input examples from the same package.

Getting ready

The BetterCharacterControl class is based on physics and requires a BulletAppState class to be set up in the application. The steps required to do this are described in the The ImageGenerator class section in Appendix, Information Fragments. To find out more about bullet and physics, refer to Chapter 8, Physics with Bullet.

How to do it...

Perform the following set of steps to create a reusable character control:

  1. Start by creating...