How to bind the interaction event of the scene to the parent node of the canvas?

I see that there is an InputManager.attachControl , but its parameter elementToAttachTo is not used, how do I need to replace the dom element of the binding event?

Although the binding can be successful in this way, I think it may not be a good way

Maybe engine.inputElement is what you are after?

1 Like

Generally speaking, the elementToAttachTo (Engine._renderingCanvas) is assigned at the creation of the engine so the best way to set it would be at that point.

As far as I know, there’s no standard way to change that value without disposing of the engine first. Keep in mind though, if you were to change this HTMLElement, there will still be events that will still be listened to with respect to said element. Just out of curiosity, what kind of scenario are you looking to do?

A different way of thinking to solve this problem