Test if a bullet will hit before shooting it?

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)

![alt text

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?

You could set the bullets trajectory to permanently target the target object and then clamp specific values such as the bullets Y value.

But if the target is moving, then the bullet would look like it’s homing.

You could also get the distance between the gun and the target, and based on the distance, multiply the bullet speed by a certain speed attribute.

Maybe even also try getting the distance between the actual bullet and its target to keep it up to date.

Its not a simple job and to achive this u need to use Math equation;

I suggest u to watch these 2 videos to give u and idea about that :