Katniss218 / HumanSpaceProgram

A WIP open-source realistic rocketry game
GNU Affero General Public License v3.0
12 stars 1 forks source link

Vessels Far from Scene Origin and Physics Accuracy #14

Open Katniss218 opened 10 months ago

Katniss218 commented 10 months ago

Current Behaviour: If a vessel is landed, and you set the scene origin far away from it (eg by switching to a different vessel), the landed vessel will eventually wiggle its way through the planet.

This happens because collisions are calculated in scene space, and when the scene origin is far away, the precision is not adequate.

Expected Behaviour: Vessels remain where they were left, regardless of how far away the scene origin has gone.

How to Fix: Vessels that are landed should be locked to their position relative to the landed on body while too far away. Vessels should have their collisions turned off while too far away (both flying and landed).

Katniss218 commented 10 months ago

If too far away - disable collisions else - enable again

if landed - pin to the surface (until close to the origin again)

Katniss218 commented 10 months ago

Since vessels will need to act like buildings when too far away from origin, maybe they can be combined into one.

Katniss218 commented 8 months ago

Vessels and buildings are already the same thing, as of 2024/01/11 (and a fair bit before too).

Vessels that are landed far away from the origin (not flying) will need to be pinned, until they come near the origin again.

KnedlikMCPE commented 3 months ago

Could it be considered to make use of 64-bit doubles on the simulation side and emulated doubles on the rendering side? It would then be practical to have separate coordinate systems for different distances - 64 bits should(tm) be enough for a solar system, but not for interstellar travel.

Katniss218 commented 2 months ago

Could it be considered to make use of 64-bit doubles on the simulation side and emulated doubles on the rendering side? It would then be practical to have separate coordinate systems for different distances - 64 bits should(tm) be enough for a solar system, but not for interstellar travel.

The issue is with collisions specifically. Collisions happen in unity's scene space. And the proposed solution is to disable physics for objects far away by pinning them to the surface (if they're landed) or by letting them float on their orbits otherwise.