Pergunta

I have a program with a Ellipse2D (which is a circle) and a Polygon object. I have decided to use the collision detection solution at this question to handle the detection of collisions.

I want the circle object to remain on top of the polygon at all times.

I now know when the Ellipse2D object intersects the polygon, but I would like to know WHERE they intersect. I don't currently know of any way to detect how high the circle object should move in order to remain on top of the polygon.

My intent is to move the circle upwards to always remain "on top" of the polygon when the two objects move toward each other horizontally.

enter image description here

Is there a tool or method out there that I am not aware of that returns a collision point or is this something I will have to develop on my own?

Foi útil?

Solução

Subtract one Area from the other. The Bounds of the resulting area will represent the overlap between the two objects. The center of the overlapping Bounds will most likely either be the collision point, or so close as to fool the viewer into thinking it is.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top