[SOLVED] Help with Invisible World Boundary + Infinite Terrain

Considering the Terrain Generation from Heightmap example, how would I go about implementing either solution shown below?

Reference:

Guidance or previous knowledge to such problem is greatly appreciated.

Hi @khaelou,

Most likely you will have to add a height generation function (e.g. based on perlin noise) so you can create procedural varied terrains for each tile.

In my experience you will need to solve two main problems when it comes to tiled/infinite terrains:

  1. Control the heightmap generation so it can be seamless: where one terrain ends, you want the next one to start from that height distribution.

  2. Handle normal generation between neighbor triangles to get correct lighting.

For more advanced cases you will have to handle LODs to not kill your triangle count, but it depends in your game if you actually need this.

I would highly recommend this tutorial series, it’s based on Three.js but the instructor does his best to convey the topics in a generic manner. You will be able to easily transfer the code to PlayCanvas:

2 Likes

As always, I appreciate this :+1:t5:

Let’s say I wanted the boundary, any logical way to wrap colliders upon all 4 sides of the plane?

Sorry, I didn’t get what you mean with the collider.

1 Like

I may give an advice, but as @Leonidas said, I am struggling to understand the use case. Can you give an example, based on your picture, of what can and cannot happen?

2 Likes

No problem, I’ll further elaborate for clarificaiton.

Example #1: Let’s say I wanted to limit players from falling off the terrain instead of fixing the player position when they did fall off.

Example #2: This would simply be ideal for procedural world generation within the game.

Hope this further makes sense.

In other words, is there a effective way to create a world boundary around the Terrain Plane preventing players from falling off?

Not sure if collision is needed here, but sounds as if it does to me.

If you are using physics (collision/rigidbody components), the naive approach I’d follow is to create 4 box colliders, each placed and sized as a wall on each side of the terrain.

1 Like