Topic was automatically imported from the old Question2Answer platform.
Asked By
jkunable
When I cast a ray that begins within a collision shape, no collision is reported, but when I cast a ray that starts outside the collision shape, a collision is reported. If possible, how do I get a collision to occur in the event that a ray is cast from within a collision shape?
(I’m using Godot 3.2.1 c# version)
Make the raycast a child of the body with the collisionshape and make sure Exclude Parent is true. If that is not possible for any reason, set the body’s collision layer different to the raycast’s collision masks
In my case the raycast cannot be a child of the body and even when I set the body’s collision layer different to the raycast’s collision mask, no collision is read if the ray cast starts within the other body’s collision shape.
I was trying to check for potential overlap between collision shapes by casting an intersect_ray() to ensure that if I spawn collision shapes at that location, there would be no other collision shape overlapping it.
Unexpectedly though, collisions wouldn’t be reported unless the start of the raycast was outside the collision shape. Using intersect_point() gives me the functionality I was looking for.