Repository navigation
Ensure parent frames always cover their children - #6469
Conversation
|
A planet's moons are supposed to be within the planet's frame. That allows the frame determination code to find child frames within the parent. If you consider a solar system, everything is within the frame of the sun, but if you get close enough to a planet, the frame of reference switches to that planet. The same principle applies to moons around planets, and stations around moons. The problem you may be thinking of is when a moon's orbit (and hence frame of reference) is too big and includes the planet - that's what was fixed in #6330. Basically, the hierarchy has to be enforced in both directions - parent frames should always include all their children, and child frames should not include the parent or each other. The fix here is because the code uses Either way, the calculation as written was wrong because it was using a far too small value for the Hill Radius in this instance. Fortunately this didn't cause problems very often because the following line looks at |
|
Ah ha, thankyou for clearing all of that up, yes I was thinking of the Moon's orbit bug! |
sturnclaw
left a comment
There was a problem hiding this comment.
This checks out on the most recently reported problem system - Rutoratto (0,-5,-8), which has a frame overlap on 3227-05-08 - so I'm merging it.
The general problem of Frame A overlaps sibling Frame B is still not solved (nor do I expect this PR to attempt to solve it), and I think that's typically an indicator of a malformed (physically impossible) system so not really worth tackling from Space.cpp.
Fixes #5830
In order for ships to correctly find the frame of reference that they are currently in, the parent frames always have to enclose their children. Occasionally, a parent frame will be too small, so that the child is outside it. This then causes ships to get confused, since the algorithm they're using can't enter the child's frame of reference.
In particular, if the child is a space station, then ships can't dock or do collision detection with it, because everything is not in the frame that the code expects it to be in.
This pull request fixes a couple of issues that would cause frames to be the wrong size, and also adds a safety check that expands any still-too-small parent frames so that they cover their children.
Save games keep any wrong frame setup, so if you load the Shibata save in #5830 it appears to still be broken, however if you then jump out and then back into the system, everything is now working.