Hello, I’m 4Slu and I’m working on a survival game with almost infinite (until the null zone) terrain generation. There’s currently ores and caves and the ores are made out of coloured terrain chunks. I’m trying to figure out how to detect the material and give the player the ore after hitting it.
The issue is I have no idea how to detect terrain infront of the player.
I’ve tried to use detect floor material and fill the area infront with air but that requires the player to stand ontop and is confusing for new players.
If you find anything your comment would be greatly appreciated, have a good day and thanks for reading.
I’m not quite sure how you’re defining ‘in front of’ in mathematical terms, but the 4th value returned by :FindPartOnRay() is material, and this works with terrain materials too. So you can continually raycast in front of the player to find the material.