Unity3D Terrain random tree generation around player

This code generates some trees around player position in Unity3D Engine.

Basically, it does the following actions:

  • Create new trees from terrain tree prototypes
  • Place the shiny new tree on a circle of radius < 80 around the player. Also remove unwanted trees (radius > 80).
  • Keep the tree number constant.
  • Optionally, recreate colliders.

It’s very simple, just wanted to share :)


Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>