Download

Extending a spline created road during game play

I followed several of the videos to create a spline in Construction script and I also created one in the Event Graph. What I’d like to do is as time goes forward in the game, add spline points to create a path with geometry. For example, if I’m making a road, have it increase in length every second by adding another spline point to the end at a new location. I’d add a random number to the the last spline point location to create the new spline point location.

It looks like having something dynamically changing during the game is probably not what the Construction Script is used for, so I haven’t tried anything past the basic spline creation in there.

So, I tried adding the “AddSplinePoint” into the Event Graph version and if didn’t work. Could be my implementation. After creating the spline, I did a 3 second delay, then the AddSplinePoint with a random x,y,z coordinate added to the last spline points location, then repeat. The spline stayed the same and no spline points or geometry was added. Any thoughts?

The Construction Script is called when an actor is first created. So any further changes that you want to make after that would have to be done through the Event Graph.

As for the splines, are you adding a Spline Mesh Component after calling the AddSplinePoint node? If not, the spline point will be added, but without a new mesh component, it wouldn’t be able to display any new road section.

Show us your implementation, is it similar to this:
https://forums.unrealengine.com/development-discussion/blueprint-visual-scripting/1714738-can-t-edit-spline-via-blueprint-at-runtime?p=1799781#post1799781

Adding to this, if you add a new spline point and a new spline mesh component to visualise it, the tangents of *previously *added points and components may need updating, too. This does not happen automatically.