Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pointer worldX, worldY not updating correctly #4658

Closed
Nick-lab opened this issue Jul 17, 2019 · 1 comment
Closed

Pointer worldX, worldY not updating correctly #4658

Nick-lab opened this issue Jul 17, 2019 · 1 comment

Comments

@Nick-lab
Copy link

As seen in the phaser example https://phaser.io/examples/v3/view/input/camera/world-coordinates if the mouse is not moved when camera is scrolled the pointers world positions are not updated. and this.input.setPollAlways(); does not fix this issue. in this instance how would i get the angle between the "player" position x/y and the pointers x/y is the pointer does not update its world x/y ?

I thought of using the main cameras scrollX and scrollY + pointers screen x/y as this will allow for correct world position hever the scrollX and scrollY are incorrect when using camera zoom

@photonstorm
Copy link
Collaborator

If you want to check the worldX/Y values outside of an input event handler, then you need to update the Pointer for the given camera first. You can do this by calling Camera.getWorldPoint(pointer.x, pointer.y) and then assigning the return values to worldX/Y. Or, you can use the function Pointer.updateWorldPoint which is new in 3.19 Beta 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants