In my 2d game, the bullet travels very fast, and the only way for the enemy’s trigger collider to detect it is to reduce the fixed timestep (I’ve already set the bullet’s collision detection to continuous). I’ve heard that you should be careful when doing this, because it’ll result in FixedUpdate being called more frequently, which can result in a decrease in performance, but here’s the thing: I don’t actually have FixedUpdate anywhere in my code. The bullet’s velocity is initially set in the Start method, and later modified in OnCollisionEnter2D. So would this mean that I’m out of the woods in terms of performance issues and can set my fixed timestep to as low as I want?
FixedUpdate is a hook in the standard game loop inside Unity. This hook is used by things that need to run in steps of the configured fixed frequency. The “FixedUpdate” script callback is hooked into it but so are the 2D and 3D physics systems which use it to actually execute a single step of the simulation. This means that if you increase the frequency (reduce the value) then the 2D/3D physics systems will execute more often per second so that has a performance impact as it’s not just about script callbacks. Hopefully that clears up the impact it’ll have.
With regards to discrete/continuous collision detection; continuous only works when the body is dynamic. Continuous works by being able to do what discrete does but as a separate (and more expensive step) it calculates exactly where it would come into contact and repositions the body there. It should make sense then that for things that cannot be affected by forces (Kinematic bodies) and contacts that don’t involve a collision response (Colliders flagged as triggers) then continuous has no effect.
If you have very fast moving objects that you need to detect against triggers but they’re moving that fast that in a single physics step they can move completely over them using Discrete col-det (collision tunnelling) then I would suggest you perform a cast query to determine if a contact is made. You can use Raycast, CircleCast etc. These can detect contacts with triggers.