Book Image

jMonkeyEngine 3.0 : Beginner's Guide

Book Image

jMonkeyEngine 3.0 : Beginner's Guide

Overview of this book

jMonkeyEngine 3.0 is a powerful set of free Java libraries that allows you to unlock your imagination, create 3D games and stunning graphics. Using jMonkeyEngine's library of time-tested methods, this book will allow you to unlock its potential and make the creation of beautiful interactive 3D environments a breeze."jMonkeyEngine 3.0 Beginner's Guide" teaches aspiring game developers how to build modern 3D games with Java. This primer on 3D programming is packed with best practices, tips and tricks and loads of example code. Progressing from elementary concepts to advanced effects, budding game developers will have their first game up and running by the end of this book.From basic concepts and project creation to building a complex 3D Game, you will learn to layout 3D scenes, make them interactive and add various multi-media effects.You will find answers to common questions including best practices and approaches, how game characters can act and interact, how to simulate solid walls and physical forces, how to take it online to play over a network and much more.From Zero to Hero, start your journey to make your game idea a reality.
Table of Contents (20 chapters)
jMonkeyEngine 3.0 Beginner's Guide
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

And how do I say that in Java?


Imagine an arrow pointing from the origin to an X-Y-Z coordinate. This arrow is called a vector. You will be using vectors to represent locations. Since a vector always starts at the origin, and the arrow points in the direction of the given (x,y,z) coordinates, a vector can also be used to specify a direction. Quite useful!

In your Java code, you use the com.jme3.math.Vector3f class for this data type. A Vector3f is an object with three float components, x, y, and z. For example:

Vector3f v = new Vector3f( 2.0f , 3.0f , -4.0f );

Remember when we created the blue cube earlier and placed it in the middle of the scene? We positioned it at the location Vector3f.ZERO. This built-in constant stands for a Vector3f(0f,0f,0f). The (0,0,0) coordinates vector represents the origin of the coordinate system, the middle of the scene.

Now that you know how to orient yourself in 3D space, we can apply this knowledge and transform our blue cube; let's position, resize, and turn...