hi i have a enemy and a script every think is working but my bullets donot collide with the enemy because they are to fast is there a another solution with out making the bullet slower
A very common solution for bullet collision is to use raycasting instead of a collider
void Update(){
bulletTravel = bulletSpeed * bulletDirection * Time.deltaTime;
RaycastHit hit;
//Cast a ray in the direction we are going to move this frame and see if we hit anything
if(Physics.Raycast(transform.position, bulletTravel, out hit, bulletTravel.magnitude)){
//We hit something, do bullet hit logic here
hit.gameObject.GetComponent<Health>().TakeDamage();
Destroy(gameObject);
} else{
//We didn't hit something, move the bullet normally
transform.position += bulletTravel;
}
}
since shots are fast, maybe few raycast on shoot only (and less damage if far) with a delay to take damage based on distance and speed