Get mouse coordinates outside of event

I’m trying to get the world coordinates for the pointer outside of the event system. So far the only way I can get those coordinates is inside the events like

this.input.on(‘pointer down’, function(pointer) {
console.log(pointer.worldX);
console.log(pointer.worldY);
});

I can get the coordinate of the pointer relative to the viewport but not to the world by this.input.x. How can I get worldX without using the event system?

You can try accessing

this.input.activePointer.worldX
2 Likes