I have a ParentNode (say 1000px by 1000px) and a centered ChildNode (say 200px by 200px). ChildNode has a script attached to it and listens to touch events and prints out Touch Coordinates. How can I get the Touch Coordinates relative to the ChildNode instead of Touch Coordinates with regard to whole screen?
For example when I click on the lower left corner of ChildNode, I want to see (10, 10) instead of (400, 400).
// Script attached to the centered child node
onLoad(){
this.node.on(Node.EventType.TOUCH_START, this.onTouch, this);
}
onTouch(event : EventTouch){
console.log(event.getLocation());
}