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

Plane cut uses "greedy" hit detection #46

Open
andybak opened this issue Sep 4, 2024 · 1 comment
Open

Plane cut uses "greedy" hit detection #46

andybak opened this issue Sep 4, 2024 · 1 comment

Comments

@andybak
Copy link

andybak commented Sep 4, 2024

From @naam00 on #34 :

relatedly, it uses a very 'greedy' approach to detect which group to slice: the world-aligned BB of the groups are used. In a more fleshed-out scene, with a lot of grouping going on, it's hard to intuit what the tool will be cutting.-> I fixed this for the hand tool. Having a hard time finding where the branch has gone (probably deleted after merge?) I'd suggest maybe even using the same hover detection as the normal cutting tool: only when actually hovering a polygon.

@andybak
Copy link
Author

andybak commented Sep 5, 2024

@naam00 I think I've got a bit closer on this one.

Your code changed the method SelectMeshAtPosition.

Plane subdiv uses selector.hoverMeshes
selector.hoverMeshes is derived from touchedMeshIds
Selector.TryHighlightingAMesh modifies touchedMeshIds using param "nearestMeshId"
nearbyFaces, nearestMesh are passed to TryHighlightingAMesh in SelectMeshAtPosition as this parameter...
(the latter is used only if former is empty)
nearbyFaces comes from spatialIndex.FindFacesClosestTo
nearestMesh comes from spatialIndex.FindNearestMeshTo

Soooooooo! I think we just need to do something similar to whatever you did previously with FindNearestMeshTo to FindFacesClosestTo

Writing all this here as there is 0 chance I will remember it in 5 minutes...

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

No branches or pull requests

1 participant