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

Crash when dragging a node #431

Closed
hshapley opened this issue Mar 2, 2024 · 1 comment
Closed

Crash when dragging a node #431

hshapley opened this issue Mar 2, 2024 · 1 comment
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@hshapley
Copy link
Contributor

hshapley commented Mar 2, 2024

When dragging a Node in ARSceneView 2.0.3, it can crash with the exception java.util.NoSuchElementException: Collection contains no element matching the predicate. This is because in Node.kt on line 873 (in onMove), it uses first instead of firstOrNull. If it used the latter, then the null check would work, but since it just uses first, it throws an exception instead. In PoseNode line 27, it uses firstOrNull, so no issue there.
I'm also not sure whether the logic is correct for the predicate - checking it.node == parent seems a little strange. Wouldn't it be better to check it.node == this, or checking both conditions?

@ThomasGorisse ThomasGorisse added bug Something isn't working help wanted Extra attention is needed labels May 27, 2024
@ThomasGorisse
Copy link
Contributor

The hit testing on parent in made in case of non AR move.
Imagine you have the follow parenting: anchor node (editable) > plane node (not editable) > model node (editable):
If you want the model node to move on its parent plane, you will look at the hit test position in the parent so the model node can move into its parent plane without moving the anchor.
If the plane is touched then the move will be transfered to its parent anchor so everything will move at the same time.

The null pointer fix is included in v2.2.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants