- Home /
Gather all coordinates of a terrain into a data structure.
I'm having a hard time getting this started, so how should I begin this process? I need it for easy placement of objects on the map using code.
I'm using C# as the scripting language, so do I create a blank script and have it gather coordinates that way? I guess i'm having a hard tim conceptualizing how I even begin this process.
Terrain.terrainData would be a good place to start! However, for this kind of thing I would do it on a case-by-case basis- whenever you wanted to place an object, raycast onto the terrain, and then use hit.point to find out the location of that specific spot.
Answer by coolranchdoritos · Oct 10, 2011 at 08:10 PM
Thanks, Terrain.terrainData seems to have some pretty useful functionality.
C# is very foreign to me, but in general for beginning the task, I'm assuming I should start a loop at the position (0,0,0), increase x until it reaches the far side of the terrain - then reset x to 0, and increase y by 1. (like reading a book!) Continue this pattern until y reaches the end and finish the loop.
Yet with C# being a blur to me, what structure should I use for this? I'll eventually need to be able to place objects onto the terrain like object.placeOnTerrain(x,y,z); Thanks for any additional input. I need the help!