Pagina's

Wednesday 9 October 2019

Talk about trees

Good morning. I've been quite busy working on Holocene over the last couple of days and I think I'm making progress finally. The procedural terrain generation is not finished yet, but for now I'll leave that there for a while to focus on what I'm actually really trying to do all along, the game.

I made a simple first person controller with a camera and some moving mechanics that I picked from my RPG project of half a year ago. Next I tried to hook it up to the trees and things on the terrain and that it's where it goes wrong first.

The reason for that it's actually pretty simple. Trees on a Unity terrain are not really objects in a way that one can add scripts to them and interact with them individually. At least, I have not been able to find a way to do that. For that reason, I cannot get a vision script to work. With a first person camera, I might be able to have the player look at the terrain as a whole, but that won't help to much, because we're not cutting the terrain to get wood. We're cutting trees.

To fix that, I'm rewriting past of the terrain generation script to allow for tree prefabs to be instantiate as separate objects. We'll have to find out if this approach will make things slow. If it does, I'll look for ways to not render objects that are not in view.



A tree object will have a parent object within a graphical element and one or more colliders. The scripts will be on the parent object or the collider, if there is just one thing. Once the player looks at the object, the GUI will give a message and certain functions will be unlocked.

I tested this a bit with a hand placed tree and that works alight. I'm now working on the generation script to allow for placement of the. The same will apply for rocks and the like, because those will be interacted with too. I think I'll be able to finish the script part today or in the weekend.

Right now, I'm using placeholder meshes to speed up development, but the plan is to replace them with my own creations. That'll take time and effort,but it'll make the game better, I think.

No comments:

Post a Comment