let pos = target.convertToNodeSpace(e.getLocation())
var polygonCollider = target.getComponent(cc.PolygonCollider);
pos.x -= target.getContentSize().width / 2;
pos.y -= target.getContentSize().height / 2;
if(!cc.Intersection.pointInPolygon(pos, polygonCollider.points)){
return
}
网友评论