# Constrain movement to road without splines

Hi there, I plan to have a bike move on a road, sometimes on one with start and end connected (closed track). While I want my bike to move to the left and right with the controler, I want the main movement along the road to be constrained, so that in case the controler doesn’t get used the bike stays on its relative position on the road while moving. Something like an automatic steering mechanism. I wondered how this could be achieved with the imported road. There’s no spline available for that purpose.

My best guess, since I’m new to UE4, is to use the collision data to do this. I could uv the collision road and check the collision of the front wheel in order to get the the uv value. Probably the uv value + {0,1} could be transformed into a world position to get the next point the bike would need to steer to. The next minus the current position would be the new position to move to.

Probably that’s something not to uncommon in a game, but I don’t know the correct expression for it, but probably somebody has an idea how to do this.

Any tips are highly appreciated!

Cheers
Tom

You can think of it as an endless amount of rail racks next to each other. If you don’t use the controler, you stay on the track, if you move to the left or right, you just change the rail track. Hope that describes it a bit better.

While there seems to be a “Find collision UV” node, I can’t find any hint of a UV coordinate to world position node. This way I could figure out the next position, when Increasing the v value of the coordinate found by the collision. The u value would stay the same in order to keep the placement on the road. Probably that’s not the way to do it after all, but just guessing…

Just use splines. You make it match the road, and that’s all there is to it. Nothing else will work the same because it doesn’t provide you with a valid direction.

Thanks for the tip, but then I would need to figure out how to import them. As far as I know that’s not been possible with the Houdini Engine so far.

P.S.: What would be the difference between an UE4 spline and a closed primitive/curve imported from Houdini? Could I trick UE4 to treat a closed mesh as a spline? I could assign uv values, tangents everything in Houdini. Just curious if this could be exchanged in the blueprints or if the UE4 spline is sooo special, that one does need to use it.

Point is that the terrain road gets created procedurally and placing a spline in UE4 on top of it more or less impossible.

You can import splines just fine. Make a CSV with XYZ of each point, and parse it in.

You can also add values for the other control points so it comes in looking exactly the same - its just not as immidiate as setting up only xyz.