Hello! I am making a tower defence like game. With enemys that can shoot the player. But. I want to make sure the bullet will hit before shooting. I am already raycasting. But. I am using addforce to add force to the bullet. So sometimes the ray will be casted. And it hits the object. So it shoots the bullet. But the bullet is too far away to hit the object so it falls down before hitting it. Here is how i am shooting the bullets:
currentBullet.GetComponent().AddForce(transform.right * bulletSpeed);
Here is an example of what is going on:
The raycast hits the target (The line represents the raycast)
It looks like the bullet will hit. Because the ray hit the object. But since i’m just adding force. This happens
Shown from the picture above. The bullet doesn’t hit the object. What can i do to fix this?