I have now coded a working shooting script of which when the bullet is created, is rotated to face the Vector3 position that the Raycasthit, as such the bullet moves straight to the point aimed at when fire was pressed.
I have also coded with this Ammo, featuring a current Magazine and reserve ammo that will run out and can be reloaded at any time, with as far as I have tested, no bugs.
Additionally, I have a simple Ammo Box script which searches inside a generate sphere collider for a gameObject with the tag player, of which if one exists tells it to Broadcast the message giveAmmo, which calls the method of the same name to give ammo.
All this started from my original shoot script which instantiated a bullet and gave it a push (addForce) which I then adapted to use a raycast to deal damage, after this I added a lineRenderer to use instead of the bullet model.
Once that was finished I then proceeded to make the bullet hit the point the ray hit.
I have also coded with this Ammo, featuring a current Magazine and reserve ammo that will run out and can be reloaded at any time, with as far as I have tested, no bugs.
Additionally, I have a simple Ammo Box script which searches inside a generate sphere collider for a gameObject with the tag player, of which if one exists tells it to Broadcast the message giveAmmo, which calls the method of the same name to give ammo.
All this started from my original shoot script which instantiated a bullet and gave it a push (addForce) which I then adapted to use a raycast to deal damage, after this I added a lineRenderer to use instead of the bullet model.
Once that was finished I then proceeded to make the bullet hit the point the ray hit.