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

Detecting cover automatically in a third-person game


Cover shooters is an ever-popular genre in today's console games. How does one code a system that recognizes and allows players to take cover? There are several ways to do this, but basically, there are two main branches, each with their benefits and drawbacks. The first branch is one where a level designer places logical cover items around the environments or where they are baked into models by an artist. This could be as simple as a bounding volume, or it could be complex with directional data as well. This has a benefit for the programmer in that it's easy to recognize when a player is inside them by comparing bounding volumes. Another benefit is that the designer has full control over where there is cover and where there isn't. A drawback is that it is labor-intensive for the designer or artist and might be inconsistent to the player.

The method we'll implement is one where there is no pregenerated cover, and it's checked in runtime...