Open Jonne-G opened 1 month ago
Note that the MRP has both a reproduction for the 2D and 3D setup. This particular project was made with Godot 4.3
This is a tricky one. Basically, the move_and_slide function does this:
It's not a real collision in terms of the physics engine.
Best use an Area3D around the player for object interactions.
This is a tricky one. Basically, the move_and_slide function does this:
* scan ahead * obstacle detected? * change velocity
It's not a real collision in terms of the physics engine.
Best use an Area3D around the player for object interactions.
In that case should I assume this is intended behaviour? If so, it feels a bit specific that collisions don't get detected one way, but do get detected the other way
Tested versions
Tested in: v4.3.stable.official [77dcf97d8] v4.0.stable.official [92bee43ad]
System information
Godot v4.3.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 (NVIDIA; 31.0.15.5134) - AMD Ryzen 5 5600G with Radeon Graphics (12 Threads)
Issue description
When a RigidBody collides with a CharacterBody (e.g. an object falls on top of the player) the RigidBody will register its
_on_body_entered
event. However, if the CharacterBody collides with the RigidBody (e.g. the player walks into an obstacle), said RigidBody will not have its_on_body_entered
event triggered. In both cases the CharacterBody does register the collision since move_and_slide returns True (as seen in the minimal reproduction project)Steps to reproduce
Create a RigidBody3D or 2D with a collision shape. Create a CharacterBody 3D or 2D (matching the RigidBody) with a collision shape. Create a ground-plane for the RigidBody to sit on, or set RigidBody gravity to 0 to keep it in case (in MRP a ground-plane is added). Drop the RigidBody on top of the Character by placing it above the CharacterBody. Note how this will trigger a
_on_body_entered
event.When the CharacterBody is given a script to move into the RigidBody, the even is not triggered.
Minimal reproduction project (MRP)
MRP.zip