How to get mouse position relative to node

I’m making a 2D game on cocos 3.7

How can I get the position of the mouse when I move in the chessboard like the image?

I used event.getLocation() to get the location, but it only returns the world location.

Thank you.

@slackmoehrle can you help me :smiley:

I don’t understand what you want to do with mouse location.

i want to set position of chess seleted follow my mouse :smiley:

You can use node.setWorldPosition(mouseLocation), then the chess piece will follow.

1 Like