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

Configurable sortOrder for raycast component #4966

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

diarmidmackenzie
Copy link
Contributor

Description:

This PR addresses use cases described here:
#4965

Changes proposed:

  • New property on raycast, which allows a user to specify a sortOrder to use, in place of the default distance order.
  • This sortOrder is provided in the form of another attribute on the objects, that takes values indicating the desired order.
  • I've also had to make a fix to cursor.js to fully trust the order of objects it gets from raycast, rather than making its own decisions based on relative distances. As far as I can tell the code I have removed here was superfluous. However this is probably the biggest risk with the PR in terms of possible regressions.

For more details o how this works see the additions to the documentation, and the example included in the PR.

@diarmidmackenzie diarmidmackenzie changed the title Raycaster priorities Configurable sortOrder for raycast component Nov 17, 2021
@diarmidmackenzie
Copy link
Contributor Author

Made a further fix to cursor.js, because raycaster was not behaving as expected.
#4974

The problem scenario was when a small object was behind a large object of equal priority. The small object was getting selected due to the fact that raycaster was not reporting the intersection with the larger object, since it was not new.

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.

1 participant