Physics: Add additional information to RigidBody's body_entered signal #7879
Replies: 2 comments 3 replies
-
Absolutely. I was going to open my own proposal, but I will piggy back on yours. The issue with properly detecting physics collisions is multi-faceted. I will try to break down my own struggles with the topic. My Use CaseMy use-case is a 'pong' style game, with a moving ball, and a moving platform. I would like to use the physics engine to detect collisions+normal between the ball and the platform, but otherwise control the ball and paddle with my own logic. Attempt 1: Area2D + Area2DI knew that I wanted full control over the physics simulation, so I chose to use two Area2D nodes. Issue: It's impossible to get the normal of the collision from Attempt 2: AnimatableBody2D + CharacterBody2DMy next attempt was moving the ball using Attempt 3: AnimatableBody2D + RigidBody2DMy next attempt was using a RigidBody2D ball, and I also tried using Attempt 4: CharacterBody2D + CharacterBody2DI think the next thing I will try is using x2 CharacterBody2D, and moving both of them with Attempt 5: Area2D + Area2DMy next set of tests were using two I also tried calling Then, I tried using Suggested Improvements1: More info in CallbacksAdd additional information to 2: Make callbacks more accessibleThe next suggestion is to move these collision callbacks out of RigidBod2D, and into the base-classes. So that means either |
Beta Was this translation helpful? Give feedback.
-
Another workaround:
|
Beta Was this translation helpful? Give feedback.
-
The body_entered signal in RigidBody3D (and similarly for RigidBody2D) currently only reports the Node of the other colliding body when a contact is created. As far as I know, there really isn't any obstacle to reporting extra information such as the position or normal of the collision. The RID of the body collided with is also present in the method that emits the signal, and it is very difficult to get this information otherwise.
I feel that this information would be really useful for something like generating collision particle effects.
Beta Was this translation helpful? Give feedback.
All reactions