Another first for me: procedural terrain collision.
As awesome as my procedural planet was last year, collision with it was limited to spherical collision based on it's radius. To actually collide with the planet, I would need to cast a ray to the centre of the planet, then evaluate the generation function at the point along that ray the radius units from the centre. Totally doable, but I just didn't have the time and there's an endless list of features I wanted to add to that application: There's literally the entire universe worth of things I could add and then some.
As awesome as my procedural planet was last year, collision with it was limited to spherical collision based on it's radius. To actually collide with the planet, I would need to cast a ray to the centre of the planet, then evaluate the generation function at the point along that ray the radius units from the centre. Totally doable, but I just didn't have the time and there's an endless list of features I wanted to add to that application: There's literally the entire universe worth of things I could add and then some.
Fortunately, working with procedural terrain build from a plane makes collision detection that bit more straight forward. All I need to do to find the height at a given position is pass in the 2D coordinates to my wrapper function which returns the height. Although I need to take into account the extra adjustments to the terrain, as the mesh is moved about so that when rendered, it defaults to the centre of the entire terrain being at the origin. The wrapper function takes this into account, as well as accounting for any adjustments to the position of the terrain.
When I got this working, and had the camera (and placeholder character) skating over the hills generated by Perlin noise as can be seen in my dev video, I was excited. It was is so awesome seeing it work exactly as I want it to. The next step is to start implementing my racer. Right now it is locked to the terrain, however I will make it so that it only does that if the position is below the terrain, otherwise it'll leave it be. From there I should be able to make the racer move across the terrain properly.
To make sure my collision is working as I want, I've implemented fractional Brownian motion and it does indeed work. I've also changed the texture to make it look more like sandy rock. The images below show the result as well as highlighting the LOD and how they appear, although you barely notice when actually on the ground. It's all going really well so far.
When I got this working, and had the camera (and placeholder character) skating over the hills generated by Perlin noise as can be seen in my dev video, I was excited. It was is so awesome seeing it work exactly as I want it to. The next step is to start implementing my racer. Right now it is locked to the terrain, however I will make it so that it only does that if the position is below the terrain, otherwise it'll leave it be. From there I should be able to make the racer move across the terrain properly.
To make sure my collision is working as I want, I've implemented fractional Brownian motion and it does indeed work. I've also changed the texture to make it look more like sandy rock. The images below show the result as well as highlighting the LOD and how they appear, although you barely notice when actually on the ground. It's all going really well so far.