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

SegmentShape2D collider not working correctly #181

Closed
mikahpls opened this issue Aug 5, 2024 · 2 comments · Fixed by #182
Closed

SegmentShape2D collider not working correctly #181

mikahpls opened this issue Aug 5, 2024 · 2 comments · Fixed by #182
Labels
bug Something isn't working

Comments

@mikahpls
Copy link

mikahpls commented Aug 5, 2024

Describe the bug

If the SegmentShape2D has negative and positive coordinates in one axis, e.g. A = (0, 100) and B = (0, -100), the collider will only work on the positive side, meaning: A = (0, 100) and B = (0, 0). The other side will be discarded bespite being shown by the debug setting "visible collision shapes"

To Reproduce

Create a StaticBody2D with a CollisionShape2D as a child. There create as a collision shape a SegmentShape2D with A = (-200, 0) and B = (200, 0). Create a Rigidbody2D with a CollisionShape2D as a child and give it a CircleShape2D. Place a copy of the Rigidbody over the left and the right side of the line and press play with Rapier2D selected as PhysicsEngine. The left Rigidbody will land on the line, the right one will fall through.

A clear and concise description of what you expected to happen.

Both Rigidbodies should land on the line.

Environment:

  • OS: Windows 11
  • Godot: v4.2.2.stable.mono.official [15073afe3]
  • Rapier2D: Cross Platform Determinism 0.7.23

Please attach a zip with project where issue occurs.

https://drive.google.com/file/d/12NpukZ67KxSGs839RAveVP9z6coZ9ghz/view?usp=drive_link
Sorry, compressed project was bigger than 25 MB.

@mikahpls mikahpls added the bug Something isn't working label Aug 5, 2024
@Ughuuu
Copy link
Contributor

Ughuuu commented Aug 5, 2024

Thanks you for making the issue. for future, you can remove the addons folder, as that is not needed.

@mikahpls
Copy link
Author

mikahpls commented Aug 5, 2024

After further investigation we found, that the vector from A to B (AB) can not have a negative component.

For example: A = (0, 100) and B = (100, 0) results in AB = (100, -100). The resulting collider will ignore the negative part of AB and realize itself in A_collider = (0, 100) and B_collider = (100, 100)

image

A temporary fix for us is to set A to (0, 0) and B = B - A. Then everything works fine.

Ughuuu added a commit that referenced this issue Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants