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

Weird collision solving using RigidBody2D and ConvexPolygonShape2D #49806

Closed
Tracked by #45334
ghsoares opened this issue Jun 21, 2021 · 2 comments
Closed
Tracked by #45334

Weird collision solving using RigidBody2D and ConvexPolygonShape2D #49806

ghsoares opened this issue Jun 21, 2021 · 2 comments

Comments

@ghsoares
Copy link

ghsoares commented Jun 21, 2021

Godot version

v3.3.2.stable.official

System information

Windows 10

Issue description

I'm creating a space game shooter with procedurally generated asteroids, using Polygon2D as collision. The problem is that using CollisonPolygon2D slows down when generating the collision, so I'm using a ConvexPolygonShape2D instead. Now, when I'm colliding the ship (also a Rigidbody2D) into the asteroid, it starts to glitch a lot, without being able to exit the collision.

CollisionIssue.mp4

Steps to reproduce

  1. Create a ConvexPolygonShape2D based Rigidbody2D and set the points in a script;
  2. Create another Rigidbody2D that will collide with the first rigidbody;
  3. Use Debug>Visible Collision Shapes to visualize the collision contact points.

Minimal reproduction project

Issue.zip

@ghsoares
Copy link
Author

ghsoares commented Oct 9, 2021

It seens that it isn't actually a bug, it is in actually a expectable result if trying to assign points to the ConvexPolygonShape2D that isn't convex, it means that you need to convert a cloud of points to a convex hull points (that's why we have the set_point_cloud function in ConvexPolygonShape2D).
So I'll propose a change on documentation to include a warning to use convex hull points instead of concave points

@Calinou
Copy link
Member

Calinou commented Oct 9, 2021

Closing in favor of godotengine/godot-docs#5313.

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

No branches or pull requests

3 participants