Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ellipse collision tests only work with circles #584

Closed
Tracked by #809
parasyte opened this issue Oct 13, 2014 · 5 comments
Closed
Tracked by #809

Ellipse collision tests only work with circles #584

parasyte opened this issue Oct 13, 2014 · 5 comments

Comments

@parasyte
Copy link
Collaborator

The collision tests for ellipse assume that the ellipse is a perfect circle, e.g. that its radius is uniform in every direction. Ellipses are allowed stretch over the X and Y axes, turning it into an oval. me.Ellipse has some properties for handling this:

  • radius is the maximum radius
  • scaleV is a unit vector representing the ratio between the maximum radius and the x,y axes.
  • radiusV is a pre-scaled vector representing the actual radius along the x and y axes.

The SAT collision tests currently only use radius, which is fine for circles. To support scaled ellipses, the radius must be scaled by scaleV and the cos and sin for the angle between the ellipses. The angle is determined using atan2.

@parasyte parasyte added this to the 1.2.0 milestone Oct 13, 2014
@obiot
Copy link
Member

obiot commented Oct 13, 2014

one small note : as a prior simple AABB collision check is done using the ellipse bounding box, "only" the collision response won't be fully accurate.

@parasyte parasyte modified the milestones: Future, 1.2.0 Oct 14, 2014
@parasyte parasyte modified the milestones: Future, 2.1.0 Oct 26, 2014
@obiot
Copy link
Member

obiot commented Nov 24, 2014

I really loved the idea in this post answer :
http://gamedev.stackexchange.com/questions/12836/ellipsoid-v-box-collision-detection

Instead of solving the collision between the ellipse and a polygon, it might be easier to calculate the inverse transformation matrix, that transforms the ellipse to a circle, and transform the polygon too using that matrix, then we can make a simple (already working) circle to polygon collision tests :)

Few comments :

  • most difficult part is probably how to calculate the transformation matrix from a polygon shape to a circle one
  • this might not be the most efficient way, as it might creates a lots of temporary object

@parasyte parasyte modified the milestones: 2.2.0, 2.1.0 Feb 7, 2015
@parasyte parasyte modified the milestones: 2.2.0, 3.0.0 Jul 26, 2015
@obiot obiot modified the milestones: 3.1.0, 3.0.0 Aug 4, 2015
@obiot
Copy link
Member

obiot commented Aug 4, 2015

same here -> 3.1.0

@obiot obiot modified the milestones: 4.0.0, 3.1.0 Apr 26, 2016
@obiot obiot removed this from the 4.0.0 milestone Sep 5, 2016
@obiot obiot closed this as completed Sep 5, 2016
@parasyte
Copy link
Collaborator Author

parasyte commented Sep 5, 2016

@obiot Did you really mean to close this ticket?

@obiot
Copy link
Member

obiot commented Sep 5, 2016

yes, i tried to clean up some tickets, and I created one with all the ellipse limitations, see #809, that refers to this one

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants