Replies: 1 comment
-
that's a great idea. would be really good and useful feature to have that easier to connect declaratively without resorting to hooks and |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently we have pointerDragBehaviour or useClick useHover events as well as imperative code like scene.onPointerX events.
Looking at r3f, it seems to pass canvas events onto their meshes allowing to write code that is similar to react-dom events:
I am wondering if we could/should wrap our scene or canvas events in some similar api? I could imagine it to be quite useful.
It might just have some performance implications, since meshes with such events would need to be pickable.
If there is interest, I hope I can find some time to look into it.
https://github.com/pmndrs/react-three-fiber/blob/master/packages/fiber/src/core/events.ts
Edit:
Looking at useClick, using ActionManager actually seems to be the right thing to use.
https://github.com/brianzinn/react-babylonjs/blob/master/packages/react-babylonjs/src/hooks/utilityHooks.ts
Beta Was this translation helpful? Give feedback.
All reactions