Quantcast
Channel: Question and Answer » libgdx
Viewing all articles
Browse latest Browse all 434

How do I check for collision between an ellipse and a rectangle?

$
0
0

I am working on LibGdx framework for developing a 2D isometric tower defense game.All my sprites are drawn in 2D isometric view.
enter image description here

I have used an array list to store 8 points at boundary in the rectangle.LibGdx has an inbuilt function (returns Boolean) ellipse.contains(x,y),by iterating through array list I can check whether any points are inside ellipse
But the problem is as shown in below picture,it wont detect the enemies in some particular cases
enter image description here

So my question is:
1)Is this a correct approach for solving these kinds of problems
2)If not can you suggest better approach for solving this problem

And I am really sorry for my poor English, I am non native English speaker.

Thank you.


Viewing all articles
Browse latest Browse all 434

Trending Articles