-
-
Notifications
You must be signed in to change notification settings - Fork 35.4k
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
Update Line.js #29679
base: dev
Are you sure you want to change the base?
Update Line.js #29679
Conversation
Modify a bug in ray intersection for line objects
📦 Bundle sizeFull ESM build, minified and gzipped.
🌳 Bundle size after tree-shakingMinimal build including a renderer, camera, empty scene, and dependencies.
|
Modify spaces
Do you mind sharing a fiddle that demonstrates the limitations of current approach? |
I'm not sure how to create a Fiddle. I'll write a code snippet for you, could you please run this snippet and check the results? |
This may be related: #12520. See the discussion -- particularly the comments regarding non-uniform scale. |
Yes, they are the same type of problem, and finding the average is not the most important. I would use the maximum value instead for more accuracy. If more precision is needed, the average can be calculated based on the weight of each axis. The most important thing is to consider the scaling of the parent node. |
Modify a bug in ray intersection for line objects
Related issue: #If a sub object of a group object contains polylines, and the group object is scaled larger by the thi.scale parameter, the threshold parameter applied during ray intersection is not synchronously scaled larger, resulting in errors in ray intersection to many line segments.Sorry, my English is very poor.
Description
Calculate the correct threshold value using the scaling factor of the matrixWorld. Previously, we used the scaling factor of the local matrix, but there was no valid scaling factor for the children nodes in the local matrix. The original scaling calculation method was too rough and inaccurate:
'const localThreshold = threshold / ( ( this.scale.x + this.scale.y + this.scale.z ) / 3 );'
The new way is:
const scaleMax = matrixWorld.getMaxScaleOnAxis();//
const localThreshold = threshold / scaleMax;
Use the world matrix and find the maximum coefficient