I am trying to generate static mesh dungeons randomly throughout my terrain and I would like any block that collides with the dungeons to be removed from the game when the terrain spawns off the start. Any block that does not collide with the dungeons should spawn normally. Someone previously suggested that I line trace as the blocks are generated, and if a colliding block is detected, than it is removed. However, I cannot figure out how to add that into my project. I tried to implement it, but it removes my entire terrain rather than just the overlapping blocks. Here are some photos of my game preview and terrain construction script for reference:
If you use AddInstanceWorldSpace, you get an index to the terrain block.
Later, when spawning buildings, if you line trace down and find terrain, you can remove it because you have the index.
Mind you, why bother, unless the ground is actually getting in the way…
EDIT: Sorry, to be more clear: These landscape segments, especially if they are HISM, don’t use any resources to speak of.
If I replace AddInstance with AddInstanceWorldSpace then the terrain completely disappears. Am I doing it wrong? Also, the ground does get in the way. The dungeons go underground and the terrain blocks the player from going down into them. Figuring this out is very important for my project.
Someone sent me these two images to help me out a little while ago but I am not quite sure how to add it into my own graphs.
Line Tracing:
Remove Overlapping Instances:
Could you possibly explain where I would need to implement these things into my graphs? I’ve tried to copy this before but it made my entire terrain disappear so I think I did it wrong.
Everyone has a different way of doing this, I wouldn’t do it like these other people, so can’t see immediately how this would fit.
I think a much easier route for you is to place the buildings first, then put the landscape underneath. That way, you can do a line trace up from the land tile and just not spawn it if there is a building there.
Does that seem good?
Yeah that seems like a good way to do it.