Bullets sime times not works on collisions

Hi
I have a 1st shooter system
And every bullet are little box collide with trail render
I like when bullets travel with trail render
And works fine but some times
Bullets pass through the enemy crossing him
And you have to wait the enemy change the angle
to kill him

Question
What is the best way to fix this isue

Maybe 2 bullets per shoot
Or
very small the enmies character controllers
Under 0.1
Or
Too fast every bullet ?

What could be the profesionl way to fix this

any help please ? or some idea ?
thanks

We really need a sticky on this topic. :slight_smile: The problem is likely the speed at which the bullet is travelling… so one frame the bullet has not yet reached the enemy and the next frame the bullet is past the enemy so a collision is never really registered. What you will need to do is come up with a little math… a ray cast to determine whether the bullet will hit the enemy, and once the bullet has exceeded that distance, consider it a hit rather than relying on the collider. Or, you could raycast backward from the bullet to determine whether the bullet passed through the character in the previous frame.

JESUS
no idea how works with raycast …

could be posible to upload the 2 MB size project
and help ?

thanks so much for any help
any idea to do this will be aprreciate so much.

On trigger entrer ?
Could be ?

If your bullets have Rigidbodies and are moving using physics (i.e. you’re setting up forces/velocity and then just letting them be moved by the engine) then change the Rigidbody’s collision detection mode to ‘continuous.’

If you’re moving the bullet from code yourself then you should remove the BoxCollider and do what Dustin said - work out what position the bullet is going to be moved to, then raycast from the current position to the new position to see if anything has been hit.