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

Fix frustum intersectsSprite bug, fix #24822 #24828

Open
wants to merge 9 commits into
base: dev
Choose a base branch
from
Open

Conversation

06wj
Copy link
Contributor

@06wj 06wj commented Oct 21, 2022

Fixed #24822

@WestLangley
Copy link
Collaborator

@06wj Thank you for this PR.

But remember, this does not have to be a pixel-perfect calculation. It is OK for the bounding sphere to be conservative (i.e., oversized).

Perhaps something less-computational may be preferable...

@WestLangley
Copy link
Collaborator

@06wj For example, the sphere center can remain at zero. Maybe it is sufficient to simply increase (double?) the radius to account for the worst-case center offset.

@06wj
Copy link
Contributor Author

06wj commented Oct 22, 2022

By changing the center and rotation, the sprite may be far away from the origin, so it is difficult to achieve this function by simple calculation.
e.g.:
image

Now, I simplify this to the bounding sphere by calculating the center point and scaling.

@WestLangley
Copy link
Collaborator

WestLangley commented Oct 22, 2022

By changing the center and rotation, the sprite may be far away from the origin

this.center = new Vector2( 0.5, 0.5 ); // should be between 0 and 1

See #12931.

Do we need to support centers outside of [ 0, 1 ]?

@06wj
Copy link
Contributor Author

06wj commented Oct 22, 2022

By changing the center and rotation, the sprite may be far away from the origin

this.center = new Vector2( 0.5, 0.5 ); // should be between 0 and 1

This restriction is not found in the documentation or in the code

@WestLangley
Copy link
Collaborator

Even if centers outside [ 0, 1 ] are supported, I think the PR only requires changing the sphere radius.

I think a sufficient radius can be computed given the center coordinates.

@06wj
Copy link
Contributor Author

06wj commented Oct 22, 2022

2022-10-22.4.01.55.mov

Added visualization of bounding spheres.

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.

Sprites with off-center .center properties potentially not rendered at frustum edges.
2 participants