Is there no way to make an elliptical collision shape?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Aris Kallergis
:warning: Old Version Published before Godot 3 was released.

I mean, if I cannot scale a CircleShape2D to make an ellipse, isn’t there any other way to use an ellipse as a collision shape? Are custom shapes supported?

Out of curiosity, do you know of any game physics engines that use ellipse colliders for rigid bodies?

I’ve glanced over some mathematical papers once regarding ellipse intersection tests, and it seemed quite computationally heavy.

avencherus | 2017-05-17 13:52

Yes please, if you know an implementation useful for games, I think Godot devs will love to hear about it.

eons | 2017-05-17 18:07

ok, i understand :slight_smile:

Aris Kallergis | 2017-05-17 18:23

:bust_in_silhouette: Reply From: Zylann

You can approximate an ellipse with a CollisionPolygon, specifically with a ConvexPolygonShape2D: ConvexPolygonShape2D — Godot Engine (stable) documentation in English

However if you use it as a rigid body, it might not behave exactly like an ellipse.
If you need rigid body simulation you could also just use a circle, if you are not in need for perfect accuracy (note that you can use a circle for physics and another shape for collision detection, but it depends on the game).

You mean I can use a non-uniformly scaled circle if I use it as a rigidbody?
If not, I believe this is a great limitation on Godot’s part.

Aris Kallergis | 2017-05-17 13:33

I don’t think you can’t use a scaled circle, that’s the point of my answer. I never tested it myself though, but given the API I don’t think it’s supports that. It’s optimized for circles, the case of ellipse was probably not important enough so far (solvable by design, splitting logic in different shapes, using polygons or cheating for performance…)
Not even Box2D supports that (at least the version used by Unity).

Zylann | 2017-05-17 20:14