This tutorial uses the Mouse Look FPS character controller developed in an earlier tutorial as a starting point to implement a simple shooting mechanic using Physics.Raycast. We also will use the UI system to create a crosshair to help with targeting and introduce the Cursor.lockstate unit. The shooting mechanic is simple in that if you have the cross hairs on a target and hit fire the target is hit and destroyed instantly. It does not cover introducing any variables that might impact the accuracy of the shot such as wind (for long distance shots), projectile speed, recoil, rate of fire, etc.
Ещё видео!