You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when pointer is over the sphere, the sphere should be green.
when pointer is over the torus, the torus should be green.
same with click events - clicking sphere should indicate sphere clicked, and same with torus.
Observed behaviour:
when moving from sphere to torus, or torus to sphere, the object that is green often doesn't update.
click indications often indicate the wrong object (not the one that was clicked on).
Cause of problem.
Problems arise with cursor+raycaster solution when you move from one object to another, but both of them remain intersected by the mouse ray.
Cursor only updates state & emits events when it receives events from raycaster.
However raycaster only emits events when the set of intersected objects changes, not when their order changes.
In this case, the set of intersected objects remains constant, it's just their (distance-based) order that changes. Hence no events from raycaster, and no updates to cursor state.
The only ways I can see to fix this would be:
1 - Have cursor operate a tick, and proactively check raycaster object list.
2 - Have new event from the raycaster called something like intersectionOrderChanged, and update cursor to handle that.
2 seems like it would be a better solution, and presumably more performant.
If cursor was going to run a tick, you may as well get rid of all the event listeners altogether & do everything on the tick...
Applications that use raycaster might also want this event, to handle this exact same situation.
My view of this is that:
handling this case is within the range of what I'd expect from cursor.
therefore there is a case for fixing this within A-Frame.
best fix would be with a new event on the raycaster, that fires whenever the order of raycasted objects changes.
I'd be happy to contribute this fix, if there's agreement that it is the correct approach.
The text was updated successfully, but these errors were encountered:
dmarcos
added a commit
to dmarcos/aframe
that referenced
this issue
Dec 10, 2021
Thanks. Potential solution at #4979. I added your example in the hello world to the PR temporarily for convenience. Would you mind taking a quick look and let me know if it works? Thanks so much.
Description:
Expected behaviour:
Observed behaviour:
Cause of problem.
Problems arise with cursor+raycaster solution when you move from one object to another, but both of them remain intersected by the mouse ray.
Cursor only updates state & emits events when it receives events from raycaster.
However raycaster only emits events when the set of intersected objects changes, not when their order changes.
In this case, the set of intersected objects remains constant, it's just their (distance-based) order that changes. Hence no events from raycaster, and no updates to cursor state.
The only ways I can see to fix this would be:
1 - Have cursor operate a tick, and proactively check raycaster object list.
2 - Have new event from the raycaster called something like intersectionOrderChanged, and update cursor to handle that.
2 seems like it would be a better solution, and presumably more performant.
My view of this is that:
The text was updated successfully, but these errors were encountered: