Hit detection delay

Hello!

I am making a rocket launcher-type-weapon and the hit detection for roblox is delayed. When the projectile (the grey cube) hits an object, it will continue moving for a split second before stopping, when it is supposed to anchor the moment it is hit. I can probably work around this with collision groups, but the bigger issue is the grey circle behind it. That is the blast radius that is created after the projectile gets anchored. However, it always lags behind the projectile when created. Is there anyway I can fix this? (By lag behind I mean it gets positioned behind the projectile when created). This lag-behind affect is not noticeable at point-blank range.

image

1 Like

The delay you mention is the lag between the client and the ROBLOX servers.
The projectile is controlled by the client and has physics. It continues on its merry way. It then collides with an object. Because it’s just a physically simulated object and the client doesn’t know it’s supposed to anchor, it bounces off and sends a Touched event. In the eyes of the client, it can just keep going. But the server, after the time the event takes to go over the network, will see the Touched event and make it anchor.

The solution is to fake the behavior you want on the client-side, as a stop-gap before the server can dictate what really happens to the projectile. Do not put the behavior entirely on the client if at all possible, just make it anchor on hit both on the client side (in a LocalScript) and the server side (in a Script).

1 Like

I tried that right now. There is still the same delay

Also, how do you know how to fix the blast radius lagging behind?

Unfortunately, .Touched resumes at 60hz while physics operates at 240, so at most 4 frames can be computed before the .Touched event fires. There is no real good solution for this at the moment, but my buddies and I are experimenting with some things. Unfortunately, devs don’t have access to these higher speeds (.Heartbeat also resumes at 60) so there’s not much we can do here.

1 Like