- Home /
Best approach for collision detection
I have projectiles that I fire from the player. These are not fast moving. Their position is manually updated using updates to transform.position in script.
I have a mesh which moves very slowly, also through manual updates to the transform.position updates via script.
I would like the OnTriggerEnter to fire on the projectile object when it collides with the mesh.
What is the best setup to make that happen?
I have a sphere collider on the projectile, and I've attached a kinematic rigidbody to it with discrete collision detection. This seems to only trigger the OnTriggerEnter sometimes, other times it passes right through. If I fire 3 shots at the mesh, all right after each other, at the same spot, some of them will trigger collision, while others will not. Unpredictable, but definitely intermittent.
I think you should maybe use raycast? Every time I've had problems with collision raycasting helped.
Your answer