Registering collision of fast moving object (SOLVED)

Hi folks, I’m currently using the Defold-Input asset to drag things around. I want to register a collision with something I’m dragging (object A) against another object (object B), however I find that if I drag the object A fast enough, it passes right through object B without any collision response. I assume this has something to do with frame rate vs how fast I’m dragging the object.

I know one option would be to make the collision boxes larger, however I’d like to avoid that if I can. Is there a way I can possibly check if I’ve passed through an object between frames?

My wild guess would be something along the lines of sending a ray between where the object is at the start of the frame and where the object is at the end of the frame and check if it passes through a collision box, but that doesn’t sound very efficient if I’m dragging the object constantly.

Let me know! thanks!

Yes, that is probably your best bet. Maybe it could be added to the features of Defold-Input and the cursor script as well. Anyway, physics.raycast() is what you want.

Thanks for the confirmation! I went ahead and experimented with raycasting while dragging and it works like a charm :ok_hand:

2 Likes