- Home /
Building placement validation on curved terrain
Im implementing a building placement system from a first person perspective. Ive got a basic setup running of: Raycast to point ahead, show 'ghosted' building, confirm location if normal not too steep, raycast straight down to that point to get Y value of new building. Great!
Thats all the basics, but id also like to be able to stop placement on the edge of a steep cliff for instance. Maybe a square of raycasts down to match the building dimensions checking for normals of the terrain or height differences. Maybe also smoothing terrain around the placed building.
Has anyone done something similar or have any advice?
I've seen the square of raycasts solution before, the smoothing of the terrain is much more involved since you'll have to modify the terrainData which can a little daunting.
I suppose doing a square of raycasts to the resolution of the terrain itself would be a guaranteed way of making sure you dont miss a spike between some rays?
Ill have a play with the smoothing. What could possibly go wrong!