Thursday, October 22, 2015

collision detection - How do I calculate distance between a point and an axis-aligned rectangle?


I have a 2D rectangle with x, y position, height and width, and a randomly positioned point nearby.


Is there a way to check if this point might collide with the rectangle if it is closer than a certain distance? Imagine an invisible radius outside of that point colliding with said rectangle. I have problems with this simply because it is not a square!





No comments:

Post a Comment

Simple past, Present perfect Past perfect

Can you tell me which form of the following sentences is the correct one please? Imagine two friends discussing the gym... I was in a good s...