Say I have a UIImageView that contains an 开发者_StackOverflow中文版image of an object that is not rectangular, i.e. a round ball. How can I check if another UIImageView (rectangular or not) intersects, or contains a point in, that object (not its frame)?
Basic example:
I have two balls rolling around on the screen, and I want to check for collision. But I don't want to check if their rects intersects eachother, since the balls are not rectangular.
I think if you have limited set of possible shapes then it is better to perform the check for each possible pair of object shapes rather then some generic algorithm. For example two circles intersect if the distance between their centers is less then the sum of their radiuses etc.
精彩评论