Help people, I have a question

Hello guys, I plan to create a train simulator for PC and I intend to create a very large map, rich in details, where I plan to create beautiful graphics, but I have a question about the origin. I play a game called Proton Bus Simulator, and it is open world, and every time an x coordinate in relation to position 0 is reached, the game is lightly locked due to moving the origin. As some of you may know Unity has a fluctuating origin, but it does not expose, and this is frustrating. There is no way to release this function because the engine is closed source. I want to do this engine because it is practical and very good, but unfortunately it does not care about the open world, at least not yet. Today only a game that uses Unity that I know that solved this problem, which is the Kerbal Space Program, but they had to rewrite part of the engine, something beyond my knowledge. Does anyone know how to release? if you have to pay (and if how much) and finally someone knows why they don’t expose it. Well, the engine is so good but get it wrong, Unreal would be the solution for me, but I found it a little more complex to work on it and it is also very heavy, but it is also very good.

  • Unity has what?
  • what fluctuating origin means?

AFAIK, Unity doesn’t address the floating point inaccuracy problem at all. Which means you will have to. The solution is to break up your world into small pieces and load them as your player travels the world. At some point (10-20-30000 units from the origin, but definitely less than 70-80000) you will need to load your new piece at the origin and teleport your player along with your other dynamic objects so the physics system doesn’t show highly pronounced errors due to floating point inaccuracy.

If you don’t want to develop such system yourself, there are a couple of great tools on the Asset Store:
https://assetstore.unity.com/packages/tools/utilities/world-streamer-36486
https://assetstore.unity.com/packages/tools/terrain/sectr-complete-2019-144433

The first one used by D.R.O.N.E. if I remember correctly (I’m not sure about this) and the second one used by a couple of games, for example the Firewatch for this very reason, although last I checked it didn’t do the origin translation, however they mentioned somewhere they’re planning to do it. You can do your research before you buy into it.

Sorry, my English is not very good, but when I said unit I meant engine, and when I said floating origin it would be floating point

You’re out of luck then. Unity doesn’t have any features like this currently.

But you don’t have to stop anything, you need just load scenes asynchronously and move objects. I don’t see what is not “clean” about these. But obviously, it is your choice.

Yes there is! They don’t expose her. Unreal has and exposes

I mean let’s say it’s noticeable +/- 50,000, if you’ve built things at 1 unit = 1 meter that’s still 100x100km game world (and 10,000 square km is a lot of content). Now if for some reason your world is just that big (or you’re generating an infinite world procedurally, repeating a tileset, etc.), it is reasonable to work through. Have a root transform for the content and just move that, then for rigidbodies just add/remove the reference to a static list on .Awake and .OnDestroy - could subclass Rigidbody and add that to your game objects instead of the generic Rigidbody component. Then when you move your content root you apply the difference to each in the list. There wouldn’t be much overhead doing that (and you would have the benefit of not having to recursively check each object in the scene for the component). Of course it’s possible something like a .currentRigidbodies exists already and traversing the hierarchy wouldn’t be necessary anyway… tbh I haven’t looked into it :smile:

Could you link some reference what are you talking about? Because IDK anything about Unity having floating origin.

Unity probably doesn’t have a floating origin feature built in, because in its simplest form it is just a rather trivial few lines of code to implement.

public void ResetToOrigin(Transform playerTransform, List<Transform> allWorldObjects)
{
    Vector3 subtractFromObjectPositions = playerTransform.position;
    playerTransform.position = Vector3.zero;  //reset player to origin
    foreach (Transform t in allWorldObjects)  //subtract the amount we move the player from the position of all other objects in the game world
    {
        t.position = t.position - subtractFromObjectPositions;
    }
}

You wouldn’t want Unity to just do this all the time for all projects, because it would break code which depends on the object’s position in the previous frame if it wasn’t designed to account for floating origin, and the vast majority of projects don’t need this functionality.

As far as Kerbel Space Program, floating origin wasn’t the reason for getting Unity editor code access. It also costs at least tens of thousands of dollars, which I’m venturing a guess from the topic of this thread you’re not prepared for fork over.