We’re working on a multiplayer game feature where a Pawn can fly around a globe, returning to its starting position after flying in a straight line. We’ve encountered several challenges and are seeking advice:
- Distance from Origin:
- The Pawn flies very far from the origin, causing issues with Niagara and SkeletalMesh.
- Gravity and Alignment:
- Unreal Engine only has Z-axis gravity, which doesn’t work for a spherical world.
- We need a way to keep the Pawn and ground aligned, ensuring the ground is always below the Pawn’s Z-axis while allowing movement around the globe.
- This alignment is crucial for maintaining the illusion of flight for multiple players.
We’ve experimented with the following approaches:
A. CesiumOriginShiftComponent:
- Set Mode = ChangeCesiumGeoreference and Distance = 0
- Result: The Earth sphere rotates while the Pawn stays in place. This works visually for a single player but isn’t suitable for multiplayer.
B. Disabled CesiumOriginShiftComponent:
- The Pawn moves around the world and aligns with the sphere.
- Issue: The Pawn moves far from the origin, distorting meshes and Niagara effects.
C. Custom WorldOriginShift:
- We created our own system to shift the world origin to the Pawn’s position after a certain distance.
- This approach breaks the alignment code somehow.
Questions:
- Where is the alignment code for actors with the Earth sphere when using CesiumOriginShiftComponent? It’s not inside the component itself, as disabling the Tick doesn’t affect alignment.
- How can we combine approaches B and C to maintain Pawn-sphere alignment while shifting the world origin locally for each player?
- When combining B and C, objects spawned in front of the camera appear lopsided. How can we fix this? Should we add alignment code to all actors or make them relative to the Pawn?
- What might be causing issues when we implement WorldOriginShift ourselves?
Any insights or suggestions would be greatly appreciated!