How to transform pointer input (x and y) before the input is sent to gameobjects in the scene?

How to transform pointer input (x and y) before the input is sent to gameobjects in the scene?

So in my case, the website that’s hosting this game rotates the game canvas (90 degress) when user in portrait orientation to force landscape mode. When it happens, the game is rendered correctly but the input is not correct (input is not rotated like the canvas).

So my approach is to transform x and y of the pointer input before the input data is sent to the scene’s gameobjects. The problem is I don’t know how to do that. Is there anyone have done or know how to do this?

Thank you

:wave:

This is tough but look at Phaser.Input.InputManager#transformPointer.

Thank you for your reply

I have trouble finding where / what to call to intercept pointer data and change it before it’s sent to gameobjects (what pointer to pass to transformPointer function)

I mean where do I pull pointer data for every click from user?

You would have to override that method, I think.

I ended up rotating the camera (and no need to transform the inputs), instead of rotating the canvas with CSS and try to transform the input. That simplified a lot :smile:

Thank you for your suggestions