I’m building flight sim.
I need to place airplane in certain point on airfield.
When I hit “Place Origin Here” on CesiumGeoreference object, and then place airplane at the begining of the runway and hit “Play”,
airplane is placed in another place than I put it.
How to solve it"
CesiumGlobeAnchor to your airplane.
Presumably you’re using a DynamicCamera or some other camera with a CesiumOriginShift component attached to it, which means that the origin of the Unity world will be moved in order to keep it near the camera for improved rendering precision. But objects without a CesiumGlobeAnchor will not be aware of the origin shift and will stay in the same place in Unity world coordinates, which means they will be in a different place on the globe.
Alternatively, you can turn off the origin shifting by removing the CesiumOriginShift component from your camera.
Well, it is working, but I have another issue:
my plane has its own origin shifting and cannot be child of CesiumGeoreference object because then it is not working.
So it needs to be parentless object. There are two ways to solve:
- set position and then unparent plane (the best option is to have event on tiles loaded)
- refactor plane origin shift code to mine needs
What will you suggest?
How and why does having a parent game object break your plane?
its own shift origin mechanism not working then and reaching very hign positions
I’m using Silantro Fight Simulator Toolkit for plane
@Marek_Bakalarczuk this probably depends on what the plane’s code is doing. I’m not familiar with that flight simulator toolkit, so I don’t know how the origin shifting of the plane works.
Cesium is designed to reference all global-based objects around the origin of a
CesiumGeoreference. This origin is just a place on the globe that you pick, to act as the center of the Unity scene. When
CesiumOriginShift is active on an object, it will always move the
CesiumGeoreference’s origin to the global location of that object, such that it is always at the origin of the scene.
So, I would try to understand what the plane origin-shifting is doing. If it’s doing something similar, then maybe you can disable the origin shifting on the plane, and only let
CesiumOriginShift make changes. Otherwise, I’m not sure if the origin-shifting on the plane is compatible with what the
CesiumGeoreference expects. If the plane gets too far from the
CesiumGeoreference’s origin, you may run into precision issues, leading to incorrect rendering and jittery movement.