Open QazPolma opened 3 years ago
I can confirm the inconsistency between Bullet and Godot Physics.
Exclusion lists should work though. In your project, you're setting self
in the exclusion list for the raycast, and because the script is on the root node, it doesn't affect the raycast. You would need to set the kinematic body itself in the exclude list to make it work properly.
Thank you for the explanation. I have updated the case accordingly.
The behavior of raycasts with Bullet in this case is due to the following code:
Even if that weren't there, there would still be this check:
There are no settings in Bullet to change this behavior, so besides documenting this there is not much we can do (unless someone changes Bullet upstream).
In GodotPhysics in master
there is a hit_from_inside
parameter that can be passed in to intersect_ray
.
This may be related, but I found that having a collisionShape that has its Z extents set below 0.5 will cause GodotPhysics to fail to hit it (in this case the intersect_ray is traveling along the X axis straight through the object). It works fine in Bullet physics, but not in GodotPhysics.
Godot version: 3.3.2.stable
OS/device including version: Linux Mint 20.1(Ubuntu 20.04 LTS)
Issue description: When raycasting from the center of a KinematicBody to another KinematicBody with "get_world().direct_space_state.intersect_ray", I get different results depending on PhysicsEngine. With "Bullet" I get the second body and with "GodotPhysics" I get the first body.
Steps to reproduce: 1.Make 2 KinematicBody objects. 2.Raycast between the 2 bodies. 3.Change "Project settings->Physics->3D->Physics Engine"
Minimal reproduction project:
RaycastBug_v2.zip
Edit: Removed the exclusion lists issue, since it was because of incorrect setup.