O'Reilly logo

jMonkeyEngine 3.0 Cookbook by Rickard Edén

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Automating trees' distribution

Placing trees and bushes in an editor is fine for many types of games. There are many cases where you need objects to be in a very specific spot. When it comes to large-scale outdoor games, you might want to have a way of placing common objects in an automatic way, at least as a base. An artist or designer might then move items around to suit the needs of the game.

In this recipe, we'll create one such way that places trees using noise. Once the base is in, we'll take a look at how the pattern can be varied with different settings.

How to do it...

To produce automatic trees' distribution, perform the following steps:

  1. We get right to the center of the things. Create a new class called TreeControl that extends AbstractControl ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required