Skip to content
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

Closed
wants to merge 8 commits into from

Conversation

oli-obk
Copy link
Contributor

@oli-obk oli-obk commented Dec 14, 2023

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 the Transforms 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 a GlobalGridCell scheme that doesn't allow for rotation and scaling.

@oli-obk
Copy link
Contributor Author

oli-obk commented Dec 14, 2023

The commits all stand on their own. I can pull out 322e9d9, 622f6e0, and 6d2ceb1 into their own PRs if you'd like to review them that way.

Copy link
Owner

@aevyrie aevyrie left a 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.

@aevyrie
Copy link
Owner

aevyrie commented Apr 12, 2024

I have a working prototype of this in the reference-frames branch.

@aevyrie
Copy link
Owner

aevyrie commented Apr 14, 2024

Closing in favor of #16

@aevyrie aevyrie closed this Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Childrens' GridCell is ignored
2 participants