-
-
Notifications
You must be signed in to change notification settings - Fork 26
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
Unexpected "Body" returned from RigidBody2D.body_entered(body) signal with Rapier Physics #178
Comments
Can you instead upload the file directly on github? As it is now it's on google drive and i don't have access to it. |
Also, what version of the Rapier plugin are you using? |
I can't upload here due to the zip size is larger than 25MB.
Rapier Physics - Cross Platform Determinism |
A solution would be to remove the addons folder as I can put that manually(in future). I have access to the repo, checking it. |
I have implemented a fix, will merge it soon |
Describe the bug
When a RigidBody2D collides with a StaticBody2D, the body_entered(body) signal should provide the "body" as the StaticBody2D. However, using Rapier Physics, it incorrectly returns the RigidBody2D instead.
To Reproduce
-Create a Node2D named "Wall".
-Add a StaticBody2D as a child of "Wall".
-Add a Sprite2D with the Wall image as a child of the StaticBody2D.
-Add a CollisionPolygon2D from the Sprite2D toolbar as a child of the StaticBody2D.
-Attach the following script to the StaticBody2D:
-Create a Node2D named "Ball".
-Add a RigidBody2D as a child of "Ball".
-Enable Contact Monitor and set Max Contact Reported to 1.
-Add a PhysicsMaterial to the RigidBody2D and set Bounce to 1.
-Add a Sprite2D with the Ball image as a child of the RigidBody2D.
-Add a CollisionPolygon2D with a CircleShape2D as a child of the RigidBody2D.
-Attach the following script to "Ball":
-Attach the following script to the RigidBody2D:
-Create a main scene.
-Add the "Wall" and position it near the bottom of the scene.
-Attach the following script to the main scene:
Expected behavior
Using GodotPhysics2D, when the "Ball" bounces off the "Wall", it prints:
This is the expected behavior.
screen-recorder-fri-aug-02-2024-20-24-25.webm
However, when using Rapier Physics, when the "Ball" bounces off the "Wall", it prints:
screen-recorder-fri-aug-02-2024-20-26-45.webm
This is incorrect. The body sent from _on_body_entered(body) should be "WallBody" instead of "BallBody".
Additionally, the last bounce did not trigger _on_body_entered(body).
Environment:
-OS: Microsoft Windows 10 Home
-Version: 10.0.19045 Build 19045
-Godot Version: 4.3rc2 (also tested on 4.2 and 4.3rc1 with the same result)
Example project(zip)
https://drive.google.com/file/d/15y4xSufl-TudEPx96C8o8-U5siQV_OMW/view?usp=sharing
The text was updated successfully, but these errors were encountered: