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 :)