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 custom animation - leaning


Custom animation is the concept of directly manipulating the bones of a character's skeleton to create animations. We will explore this by making a control that can be used together with Chapter 2, Cameras and Game Controls. Together with this recipe, leaning can be used on characters other than the player and in networked games.

Jaime leaning to the left

As in Chapter 2, Cameras and Game Controls, we have two ways to handle leaning: one is by using a key to lean toward the left and another to lean toward the right. The second one is to press a button and lean in any direction using the mouse, which is more common in computer games.

Getting ready

The control we are going to build will share some code with the recipe from Chapter 2, Cameras and Game Controls. The shared code will be explained there to save space, and it will most likely be used in tandem with this recipe, so being familiar with it is helpful.

How to do it...

  1. We start by creating a new class...