-
Notifications
You must be signed in to change notification settings - Fork 271
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: use bounding sphere when bounding box not available #340
fix: use bounding sphere when bounding box not available #340
Conversation
jesse-small
commented
Jun 1, 2023
•
edited
Loading
edited
- getBounds now returns a bounding box from the bounding sphere when a cached bounding box is not available
- calculateError now correctly applies the inverse transform matrix to the bounding sphere before calculating distance
src/three/TilesRenderer.js
Outdated
// Sphere#distanceToPoint is negative inside the sphere, whereas Box3#distanceToPoint is | ||
// zero inside the box. Clipping the distance to a minimum of zero ensures that both | ||
// types of bounding volume behave the same way. | ||
distance = Math.max( boundingSphere.distanceToPoint( tempVector ), 0 ); | ||
distance = Math.max( tempSphere.distanceToPoint( tempVector ), 0 ); |
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.
Since we save a transformed bounding sphere this was causing the calculate error to always be wrong for bounding spheres when a transform matrix was present. This applies the inverseTransform to the bounding sphere before calculating the distance.
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.
Awesome thank you! I've left a few comments.
I added the raycasting logic along with an explanation to this PR #347 |
Great thank you! |