The first system I researched on was the use of Bezier curves, which I planned would be how the car turns around a corner smoothly.
The Code:
Here is the code that I produced using the tutorial video from my research page.
The code works by using 4 Vector3 variables which is the pivot points which make the curve. The car then goes around the set curve at a set speed using the "Speed" float and "Time.deltaTime".
This code resulted as expected, however the car would not link to different bezier curves, and if the car was ever hit by the player, it would teleport straight back to the path and it doesn't look realistic.
The results:
Here is a screenshot of a gizmos line that the code produced. The line shows me exactly where the car will go and the green points are the pivot points.
after producing the code I ran into a few problems.
Pros and cons?
Pros:
the car did go along the gizmos line smoothly and quickly. I was able to set the speed at which it moves too.
Cons:
while the car did go around the line smoothly I did encounter a few issues that prevented me from fully optimizing this system. Firstly the car never detaches from the line, what this means if that a player knocks the AI, it will not move and would most likely be too difficult to beat.
Secondly I was unable to connect 2 Bezier curves together, in other words the car was unable to complete a full circle so this system does not work.
Reflection:
While I do feel time was wasted since this system didn't work as I had intended it to, I still learnt and developed some skills in coding which will make further coding in this project a little easier as I understand AI better after this failure.