Creating A Racing Line For an AI Path

297 Views Asked by At

I am currently creating a top down racing game ( or trying! ) using SpriteKit. I am creating tracks procedurally with catmullrom splines created from points. I have access to three sets of points, the inside of the track, the outside of the track and the centre line of the track.

A representation of a track showing current AI path line

I am using GKAgents, GKGoals, and GKBehaviours from GameplayKit for the AI cars, and I currently have a few cars following a GKPath. The points I have provided to GKPath are the centre line shown in yellow in the image.

My maths skills are not all that! So my question is given that I know the inner, outer and centre points, how can I modify my centre line points to create a more realistic racing line for the AI cars to follow?

If you need a clearer idea of what is going on, you can see the central points in a video: https://www.youtube.com/watch?v=yhwNL0iCBuU

0

There are 0 best solutions below