
I want to know the distance from a particular point to a particular shape. The point is just a point in the World somewhere and the shape is attached to a body by a fixture.
At the moment, I'm just doing some raycasting, but it doesn't necessarily get me the closest point unless I send out lots of rays.
Is there a different approach I could consider?



Have you tried using the body's world position and use the distance formula from the point you're looking at?



Yes, that does give me an approximation, but there are cases when it is wrong enough to cause me trouble.
For example, say my point in space is near one end of a long, thin plankshaped Shape. The associated Body's position of that Shape can be a long way from the end of the plank, if the plank is long. So the distance formula in this case makes
it look like the point in space is a long way from the Shape/Body but really it is very close.



Hrm...if your shape is simple enough like a quad, you could try getting the vertices for that shape. I guess from there, you can find the shortest distance from your object's point to the 4 vertices?



Yes, that could be a better approximation, I will investigate that, thanks.



Check out FarseerPhysics.Collision.Distance.ComputeDistance. You can use this to find the closest points between two shapes, and I'm fairly certain a CircleShape with a Radius of 0 is legit.

