Is there a way to zero world origin to a new location?

You sir are in luck.


I am fairly certain its impossible, but just in case it is - is it possible to set world origin to a new location and have it reset the whole coordinate system to that new location as 0,0,0?

I am making an endless runner, and it would help with precision loss at great distances.

If I am thinking about it wrong, please let me know. Currently I just spawn actor tiles in front of the player based on a trigger volume, and destroy them in the same way.

SilentX, I’ve tried it, but it does not shift the coordinate system. It simply anchors world origin to new location at x,y,z.

I assumed it did that. I know this can be a problem for infinite runners or games that are large in general. KSP had a talk on it, so I’m familiar with the problem.

Unfortunately I don’t have an immediate answer, sorry about that.

@PeterLNewton it appears you’re right. But its not as straight forward as just calling that function. I’m posting answer with BP solution.

You have to add existing world origin to new location to zero it to a given coordinate. This effectively resets the world to new location - which is very useful for anyone writing large single player games or endless runners.

or C++

World->SetNewWorldOrigin(FIntVector(newO.X, newO.Y, newO.Z) + World->OriginLocation);
1 Like

Truncate was what I was looking for. Upvoted.

mxnko thank you so much for your solution. I never ever would have thought of adding it. It makes no sense why just setting the origin to the actors location doesn’t actually set it there.

it does make sense. getting the actor location while the origin is shifted to it will return something near 0, because it’s almost exactly at the shifted origin.