appsinacup / godot-rapier-physics

Godot Rapier Physics – A 2D and 3D drop-in replacement for the Godot engine that adds stability and fluids.
https://godot.rapier.rs
MIT License
348 stars 17 forks source link

TouchScreenButtons break with Rapier2D enabled #171

Closed Robert-K closed 2 months ago

Robert-K commented 2 months ago

Describe the bug

If you enable Rapier 2D physics in Godot Project, TouchScreenButtons register no more touch events. As soon as I disable the Rapier physics, they start working again.

To Reproduce

Add this to your project settings:

[physics]
2d/physics_engine="Rapier2D"w

Add a TouchScreenButton to any scene. It will not emit any signals or InputEvents on touch.

Expected behavior

TouchScreenButtons should be unaffected by Rapier or at least work similarly.

Environment:

Example Project: touch-buttons-test.zip

"Mouse input as touch" is enabled, so this can also be tested using the mouse. Tapping the button/pressing space will print "Hey!". If I enable Rapier, it doesn't.

Ughuuu commented 2 months ago

The touchscreen button uses shape_collide with no motion, and in rapier the function without motion results in no result, bc it can't put a direction (eg normal results in size 0). So put a small motion to both of 0.001 (before they also had this, but they both had same motion, so same issue, so now changed to put to one a motion of -0.001, -0.001 and other 0.001, 0.001).