+1 vote

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?

in Engine by (39 points)

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.

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

ok, i understand :)

1 Answer

0 votes
Best answer

You can approximate an ellipse with a CollisionPolygon, specifically with a ConvexPolygonShape2D: http://docs.godotengine.org/en/stable/classes/class_convexpolygonshape2d.html#class-convexpolygonshape2d

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).

by (28,789 points)
selected by

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.

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).

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.