I have created a 3D game in unity with terrain and some models, where the player can go anywhere he wants and the camera follows him.
my problem is when the user is behind a tree, how do I make the tree transparent?
I have already done it to the other models with Ray casting but the trees are part of the terrain and therefore I get the terrain material and not the specific tree.
any ideas?
thanks in advance
Well the best solution would be to start a Ray from camera to forward, and then put the camera a bit farther than the collision point, so that you can't see the tree.
Remember to put the old camera position from where should be in order that the camera doesn't go away and stays there, and that the camera and old camera has the same code of position and rotation before this happens and then you just change their position. I mean I don't know if it's okay but you can take conclusions from this.
Sorry for mistakes I'm from Spain.