Two objects collide, but the collision physics isn't applied - how to fix?

Hi,

I’m making a shooter game where the player shoots a projectile at a target, and the impact makes the target moves according to the hit (Unity default physics simulation).

The problem I am having is: Sometimes, apparently randomly, the game detects the collision (debugging with OnCollisionEnter), but the projectile goes through the target and therefore there is no “impact”.

Both the projectile and the target have rigidbodies with collision set to continuous, interpolate, and are fixed on the Z axis (the game is effectively 2D, so the shot never comes in that direction)

What I tried so far:

  • Changing the collision detection method in the target and projectile (all combinations)
  • Reducing speed on the projectile, as it could have been going through in less than 1 frame. Didn’t work. I also tested this with OnCollisionStay. What happens is: the game detects the collision for 1 frame, detects OnCollisionStay for 2-3 frames, and then OnCollisionExit for 1 frame

I searched the forum but all I could find was relating to triggers (which I’m not using).

Is there a way to fix this, or is it an engine limitation? Are there any “tricks” to avoid it?

I can provide pics and maybe even a video if that helps

Thanks!

@gregsantos You said both the projectile and target have rigidbodies but make sure they also have colliders attached to them (both the target and projectile). if issue still persists please share your script