Raycast within a collision object is not detected

If both the from and to position on a raycast is within a collisionobject, a ray_cast_response for that collision object is never triggered, which I think it should (allthough I happily confess I am not 100% sure and there might be a very good rationale behind not doing so)

Yes, I think any collision has to happen across the hull of the object. If you put a small collision shape totally within a large no collision happens either.

I don’t know atm if there is a plan on how to deal with this but we’ll look into it.

The problem in this specific case is we have bombs that go off and send a ray to see if there is a wall between the player/enemy and the bomb. Now if you stand close enough the ray will never hit and you won’t get hurt. In this case, solving the issue where a ray not colliding with anything should also send some kind of message would be enough (and that is actually a more high priority issue).

1 Like

Ray cast miss messages is in the backlog if I’m not mistaken (don’t have access right now to check).

Yes this is a prioritised feature in our backlog. Thanks!

The ray cast miss message has finally been added to Defold 1.2.115

5 Likes

Currently small objects completely within other objects do respond to collisions with contact_point_response, but raycasts completely within large objects still do not produce anything but ray_cast_missed.

It would still be good for raycasts to respond when completely within other objects. Without this they are less useful…

Does it work that way in Box2D? I see nothing different from their example code and ours :confused:

2 Likes

I’m not sure, but I think I have a workaround of making the raycast start slightly before and after its length with each step in its movement. Then if the shooter’s own collision object is within a larger body use that to know hit is instant.