문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top