

The hitMarker is a simple sphere we will add to the position where the bullet hit. The mainCamera is the camera attached to the first person controller, the sightImage is our sniper scope, the bulletObj is the bullet we are going to fire, and the targetObj and mirrorTargetObj are the targets we created. When you are done it should look like this:Ĭreate a script called SniperController and add the code below. Also add Unity's first person controller. Also create some kind of arrow from 2 cubes so we can show in which direction the wind is coming from. Also create a cube at the center of the scene so you have somewhere to fire from. I also had to scale it 3 times so it fits the entire screen. To add the scope image to the scene, right-click -> UI -> Image, and add the scope as the source image. The scope image should be a Sprite (2D and UI). We will need a mirror of the target to easier see what we hit so we don't have to run to the target and back again each time we have fired a bullet. Name one Target and the other Target mirror. The target texture should be a Texture and you should add it to a material. While you are googling, you should also find an image that we can use as a target. In this part of the tutorial you will learn how to add a sniper rifle that can zoom and fire realistic bulletsįirst of all we need a sniper rifle, which in this case will consist of a scope, so go to Google and download your favorite scope image.
