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

CharacterBody2D and body_test_motion do not detect corner collisions on CollisionPolygon2Ds with build_mode = BUILD_SEGMENTS #88227

Closed
Pizzaandy opened this issue Feb 11, 2024 · 0 comments · Fixed by #88282

Comments

@Pizzaandy
Copy link

Tested versions

Reproducible in:
v4.3.dev3.mono.official [36e943b]

System information

Godot v4.2.1.stable.mono - Windows 10.0.19045 - GLES3 (Compatibility) - NVIDIA GeForce RTX 3070 (NVIDIA; 31.0.15.4665) - AMD Ryzen 7 3700X 8-Core Processor (16 Threads)

Issue description

CharacterBody2D and body_test_motion do not detect corners on CollisionPolygon2Ds built with segments. This can be seen by the CharacterBody2D launching off the corner of the polygon labeled "Segments."

BodyTestMotion_Against_Segments.mp4

The circle is a CharacterBody2D with the "Basic Movement" template script. Its snap length is set to 100px.

The box that follows the mouse is a static body that runs body_test_motion from the mouse downwards. It turns red when the test does not collide with anything.
Note that body_test_motion becomes less accurate as motion length increases, so its distance has been limited to 200 for this demo.

Steps to reproduce

  1. Enable Debug -> Visible Collision Shapes
  2. Run the MRP and use the arrow keys to move the CharacterBody2D
  3. Observe that the character launches off the polygon labeled "Segments" and not the one labeled "Solids"
  4. Hover the mouse above each polygon
  5. Observe that body_test_motion does not detect a collision at the top of the polygon labeled "Segments."
  6. Modify each collision shape to test as needed.

Minimal reproduction project (MRP)

MRP_CharacterBody2D_Segments_Bug.zip

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

Successfully merging a pull request may close this issue.

2 participants