Part 1 talked about using triggers as checkpoints for the player. It was a relatively basic concept that I was able to implement after I learned of the useful component of triggers. After I did this I noticed that I would probably want a system in which the bike can turn corners and follow the path without having the user do anything. This would have to be implemented because by the time my project would be finished, there would be no turning mechanism that the user could input.

Making an object follow a path is rather straight forward if you want a very basic path, but my path is going through steep terrain and turns which is quite difficult to make an object follow.

I visited with my onsite advisory, Rodrigo, and he brought up the ingenious idea of using Bezier Curves for a path following mechanism. Bezier are a bit complicated but I will try to explain.

In short , Bezier Curves are parametric equations that are often used in computer graphics and similar fields. For simplicity, we will be looking at a two point Bezier Curve. If you have two points Po and P1 and you want an object to follow the path between those two points then you step up a basic equation…

This equation tells you the percentage of each point you are at. You can think of t as the percentage at which you have completed the path. If t is at 0.75, then P1 is going to be a greater value than Po so your final position (B(t)) will be closer to P1. This concept can be better visualized below…

A two point Bezier Curve is the simplest form and as you add more points the equation and concept gets more complicated. Below you can see a Bezier Curve with 4 points…

What I am working on is to create Bezier Curves that follow my Mount Lemmon road. Once I do that then all I have to do is to have my bicycle follow the path by making it the point in the path similar to the point in the first picture.

Farewell till next post where I talk about trying to accurately place the Mount Lemmon road onto my terrain!

### Like this:

Like Loading...

*Related*