OnTriggerEnter not called for projectiles on low FPS

Hi, I already kinda know how to fix it in my case, but I just wanted to know are there any universal/stable solutions to that?.

One would be making bigger collider which can be suitable if speed isn’t too high.
Another would be using continous detection on rigidbody, but afaik it won’t work without actual collision (correct me if i’m wrong). And if you don’t use trigger rigidbody will affect others.
Maybe there are some existing algorithms, like recording delta-movement and then raycasting for object to hit between current and previous position?
How for example ballistic in Battlefield-like game would work in Unity?

How low is low in actual framerate numbers?
Anything below 20 fps is not playable, so I simply wouldn‘t bother fixing this. But first I‘d check the profiler to see if I can do anything about improving the performance. Chances are you can improve it by several factors if you‘ve never actually profiled or cared much for efficiency.

In any case, the obvious fix is continuous collision detection. However this might drag down performance even more.

1 Like

What do you mean by “algorithm”. It’s pretty simple to project forward by the velocity of the projectile (or use a Kinematic Rigidbody with a script and apply velocity/gravity/etc) using a physics query and move in a time-integrated way or to any hit-point you find & trigger a projectile contact.

1 Like

I think it can happen at any FPS. Greater FPS just allows for faster projectiles, but there’s still a limit at which object will go through other objects and triggerEnter won’t be detected.
But yep, I tried something simple with raycast(previousPosition, deltaMovement, speed * deltaTime) and it works reliably in my case, can probably be done with sphereCast as well. Seems like it’s so straightforward and simple that there’s actually no algorithm for this. It seems that I overthought the problem.