Time for action – rotate it!

Your cubes are at the right location and have the right size. Now you want to turn them to face in a specific direction. In an actual game, for example, you may want to turn characters to face an interesting part of the scene. Again, you can either use absolute or relative rotation.

For every rotation, you have to specify three float values—x, y, and z, one for each axis, around which you want to rotate. In contrast to translation and scale, rotations are not expressed in world units, but in radians. Don't worry—to convert between the familiar 360 degrees to radians, simply multiply the degree value by the built-in FastMath.DEG_TO_RAD constant, or FastMath.RAD_TO_DEG to convert it back. You can find this constant in ...

Get jMonkeyEngine 3.0 Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.