top of page

Making a Racing Game Framework Part 3

 

Now we've got our new spline component (which will be a "Child" of our original Spline Component) we can start adding points to it. The extra nodes we'll need for this are a 

For Loop

A for loop will execute whatever is in "Loop Body" a set number of times, this number of times is the difference between First and Last Index, for example if I just Loop Body > (Index > Print String) and my first index is 0, and my last is 2, it'll print 0,1,2

Clear Spline Points

This Clears all points to whatever Spline Component you put in (We use this as to avoid over filling our spline)

Add Spline World Point

This takes a World Position and a Spline Component and just adds a point at the new location 

 

 

So how do we work out where to place the points we need?, as they take in a world Location. We can use the "Get world Location at Distance Along Spline" Node! 

 

So if we get Spline Length and Divide it by our distance between points (I use 340) that gives us the amount of points we'll need to use.

 

We can then loop for the amount of points we need and then Just Times our "Current Index" by the distance between points to get the distance along the spline we need for our "Get world Location" node.

 

Once we've then got that we can Add the Spline world point at this location.

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

  • s-facebook
  • Twitter Metallic
bottom of page