Download

Problems with Endless Spline Mesh

I have been trying to make an endless racing game, where road is procedurally generated as game plays out. However, there is a problem that I still can’t solve after trying a number of things.

Spline mesh is the road, and player controls a car on this road.

I have written custom and simple physics for my car with line traces, I use linetraces under the car to calculate roll-pitch of car and line traces on sides, front and back of car to calculate if car hits anything or not. If there is a frontal collision the car stops.

Weird problems arise after player proceeds a few hundred thousand unreal units. Car gets twitchy on road, and sometimes the car collides with spline mesh and stops even though there is nothing in front of it. I simply tried reversing a bit and going forward again and no collision detected this time. Also, car starts go get twitch on roll-pitch changes.

I am shifting world origin at every 100K unreal units and I am moving everything towards origin every 250K unreal units . So floating point errors should not be a problem.

Does anyone have an idea what may be causing this problem or how can I solve it? Thanks for reading.

If you goes for large world coordinates, chances are you might see what’s not expected.

The trick is to create the environment such that your endless road is divided into tracks. And you can spawn them from a memory pool.