08-21-2024 04:43 AM
I created a UI. When I scrolled the scrollview with a ray, once the ray went beyond the range of the UI panel, the scrollview would immediately bounce back to a wrong position. Then I tried to look at the official Demo. In the ComprehensiveRigExample.unity Demo, the Scrollview still had this problem.
Solved! Go to Solution.
08-23-2024 02:51 PM
Looks like the behavior in the ComprehensiveRigExample scene was caused by not having the `SelectSurface` on CanvasInteractables object's `RayInteractor` set. That surface is what allows the ray to continue hitting something even when it goes off the edge of the panel, so having it not set disrupts the ability to keep scrolling beyond the edge of the panel. Our fix will come in a future release, but you can fix this locally by just dragging the CanvasPanel object into "CanvasInteractables > RayInteractable > Optionals > SelectSurface." You should likely be able to do something similar for your own UI as well. Hope this helps, and best of luck!
08-23-2024 08:27 AM
Hi ReturnLegend, thanks for bringing this to our attention! We've confirmed we're able to reproduce the same behavior, we're investigating the cause, and we hope to get back to you with more information soon. Thanks for your patience!
08-23-2024 02:51 PM
Looks like the behavior in the ComprehensiveRigExample scene was caused by not having the `SelectSurface` on CanvasInteractables object's `RayInteractor` set. That surface is what allows the ray to continue hitting something even when it goes off the edge of the panel, so having it not set disrupts the ability to keep scrolling beyond the edge of the panel. Our fix will come in a future release, but you can fix this locally by just dragging the CanvasPanel object into "CanvasInteractables > RayInteractable > Optionals > SelectSurface." You should likely be able to do something similar for your own UI as well. Hope this helps, and best of luck!
08-23-2024 08:33 PM
Thanks for you reply, this problem is solved!
But I still have a little question. I drag the CanvasPanel object into "CanvasInteractables > RayInteractable > Optionals > SelectSurface." Since the "Plane Suface" on "CanvasPanel" is not infinite, when you drag the scrollview if the ray outside this CanvasPanel boundary (although the boundary is very large), the above problem will still occur. Is this in line with expectations?
08-26-2024 08:59 AM
Glad it worked for you! I believe the `PlaneSurface` conceptually is infinite (though of course in practice that's subject to floating point math and other such constraints), so you shouldn't be able to raycast off the edge of it per se. However, if you point your controller backwards (away from the panel so that the ray no longer intersects the plane at all), you will likely see the same behavior you saw before, which will look like you traced off the edge of the plane. What's actually happening is is that, when the raycast does not hit the select surface, the `PointerEvent`s generated by the interactor no longer have a real position and default to (0, 0, 0). The canvas interprets this as your interaction point suddenly dropping to the floor (or wherever the world origin is), which is why the scroll view appears to be instantly pulled very far down. We're looking into the best way to address this, but it'll likely require a bigger behavior change than just setting the select surface. Hope this was helpful!
08-26-2024 06:34 PM
Got it! Thank you very much for your detailed answer