How to get mouse down coordinates in local space?

I am using Cocos Creator 3

I have a sprite on the screen. I am getting mouse down location with following;

this.node.on(Node.EventType.MOUSE_DOWN, (event: EventMouse) => {

            console.log(event);

        });

It seems like these are global coordinates.
Is there a way to get them in local coordinates?

image
hi,Is this what you want?

It seems the positions I am getting is global screen coordinates
What I would like to get is coordinates local to the sprite.
If I click bottom left of the image I am getting
Vec2 {x: 110.5, y: 256}

But I should be getting something closer to 0,0 if it is local to the sprite right?

image

it seems this is what you want.
for example:
image
The clicked position is the coordinates of the anchor point relative to the node.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.