TerrainQuad : Holes and caves


I have two question on TerrainQued. I found a few threads about it but they are old, so maybe there is something new.

  1. Is it possible to make unwalkable hole using TerrainQuad ? If it can’t be directly, what are the best practices to do that ?

  2. Is it possible to make caves using TerrainQuad ? If not, same question than first one :smile:

Thanks in advance for help !

  1. What is an “unwalkable hole”?
  2. No.
  1. Eg. lets say you don’t want to let your character walk on some squares of the terrain. An easy and efficient way would be to have a collection(eg. list) of these tiles (eg, tile at (5,2) of the terrain quad ). Then, in your update loop, before you move the player to new position, check if that new position is not contained within the list. To do the check: obtain the grid position from position of the player. Binary search it in the list. If it’s found, do not move the player there. That is the general idea. You can extend it to support other shapes than just squares if you want, then the square will be just a bounding volume to your custom shape.

  2. You can treat the terrain as a bottom of a cave. The top will be covered by object. However, if the player does enter the cave, i would load a cave terrain/model and hide the previous one.

very cheap solution, create a box/xylinder shape there with no visible node :stuck_out_tongue:

Ok, thanks for your advices, I’ll try it !