How to handle touch event properly in a scaled node

How to handle touch event properly in a scaled node
0

#1

I have a board game in which the whole board and other sprites that moves on touch event are there. Touch event is handled inside that node based class. For some reason I have to scale down the node to make it fit for ipads. But the touch doesn’t work properly. Touch points location and the actually sprites location after scaling down the node is not matching. How can I fix this issue ?
P.S. I’m not using director->setContentScaleFactor. Just scaled down a node.


#2

How do you handle touches?


#3

Like in the regular way, inside a custom class (node extended). Only the problem is with touch location and actual position of the sprites is not matching.


#4

Convert the touch location to node space.

this->convertToNodeSpace(point)

#5

Thanks a lot :slight_smile: it worked :slight_smile:
You are a savior :smiley: