top of page

Making a Racing Game Framework Part 4

 

 

 

Now we should have one overlayed spline in the centre of the road with quite a few spline points! However, to increase the accuracy of our method we will need to create a few more based upon the new spline. 

To do this We will want a ForLoop which starts at 0 and last index's at (Mid Spline > NumSplinePoints)

 

 

We then want a nested ForLoop which will execute 4 times (0-3), as we are going to be creating 4 more splines at slight offsets to the main spline

 

This is the script we use to workout the World Location which we want for our new spline points, We will have a Far left, Left, Right and Far Right. The "Index" (The Cyan / Light Green line)  Is taken from our 0-3 from our nested for loop. 0 = Left, 1 = Far Left, 2 = Right, 3 = Far Right. The 90 and -90 determine which is leftand right (+90 for the Left Spline Points and -90 for the right ones) and the 1 & 2 Determines if its close (1) or far (2). We then set the Z Value back to the same Z value as the Mid Points otherwise they end up above or below the road occasionally 

 

After this we've got the location we need to Actually "Add Spline World Point", However this is still dependant on the interation of our nested loop (The Cyan / Light Green Line) 

 

This is what our entire blueprint should look like below, Remember you MUST have the creation of the "Mid Spline" set before the creating of all the other splines otherwise they'll error out (As the other splines use the mid splines point location for the creation of their own points, and if it doesn't exist it'll error out or crash). We don't have to use a sequence node here, we could have the 2nd part of the sequence comming out of the "Completed" section of the first for loop.

© 2023 by Web-Designer. Proudly created with Wix.com

  • s-facebook
  • Twitter Metallic
bottom of page