-
-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
offset childrens' GridCells from their parent #13
Conversation
…ery at the same time
…t planet sizes. Otherwise, when the moon becomes a child of the earth, we would use the scale to scale the distance between the earth and the moon, which would be annoying.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been casually mulling this over in the back of my head for a while now. I think we would want to respect the rotation of the parent, but not the scale. A good test would be tracking an object on the moon, rotating on its axis (grid follows object rotation), rotating about the earth, rotating about the sun. This should make it much easier to keep objects in the same grid from moving relative to each other. Only thing I'm unsure of is if there is enough precision to handle rotating large grids, and where that breaks down.
I have a working prototype of this in the |
Closing in favor of #16 |
Modulo some cleanups and writing a demo, this is the absolute minimal change (on top of #12) that fixes #11
It is hacky, as it accumulates floating point errors across children. This is likely no issue, but it may become an issue if the camera is a child of a moving object, or if a child of a faraway object is near the camera. I have not tested this yet, but I would like to fix it properly.
The proper fix that I can think of is to do something like
GlobalTransform
(GlobalGridCell
) that is the accumulated result of all parents' grid cells. Though if we implemented that naively, we'd be ignoring the rotations and scales of theTransform
s of the parents. This could all get very expensive, so it doesn't seem unreasonable to me to just reject this PR and #11 and add some helper logic to handle aGlobalGridCell
scheme that doesn't allow for rotation and scaling.