I want to extend the survival shooter so that when the cursor is closer to the player the player would essentially fire into the floor, and when the cursor is farther away from the player the player would shoot into the air.
I’m not really sure how to do this, could anyone help me?
To extend this again, if anyone could then describe what might be needed to have bullets be effected by gravity like in the tanks game, would that require the whole shooting script to be rewritten?
ideally I would like the player to be able to shoot over the top of objects using these 2 extensions.
Thanks for any help in advance.
I’m not sure what the first part of your question means, so I will assume (due to the second part) you mean is to control the distance the bullet will fly based on where the player looks. For that you need to shoot your projectile in the direction of your camera.transform.forward vector.
Now for the second part, if you make your projectile have a non-kinematic rigidbody, and for launching it you use a force, it will be affected by gravity and naturally move in an arc.
Note that the force with which you launch your projectile will determine both its velocity and the maximum distance it can reach. So you should probably allow the player to determine the shooting force (between a minimum and maximum value), for example depending on how long the shooting button is held.