Wednesday 18 June 2014

Sniper shooter Part 2

Sniper shooter prototype part 2:

Lets set up cameras for the game. We need two cameras for the gun after setting them up we will add the cameras to the gun prefab so that it can be reused easily. Follow the steps for this purpose

  • Download the following textures of crosshair for normal and zoom camera 



Normal cam crosshair

Zoom cam crosshair


  • Make an empty game object in your scene name it as player or whatever you like.
  • Make GunsAndHands prefab child of this gameobject you created and change its position to (0,0.7297325,0).
  • Now make another empty gameobject in the scene (name it cameras) make this gameobject child of "player" gameobject then change its position vector to (0,1,0)
  • Create a camera gameobject in the scene name it as MainCamera change the tag of this gameobject to "MainCamera"(you will have to create a new tag) with the following settings



  • Make the MainCamera gameobject child of "cameras" and change its position  to (0,-0.177351,0)
  • Now the next camera will be of zoom so it will a have a lesser Field of view(FOV)
    and more far clipping than main camera so create a new camera with the following settings and name it as ZoomCamera with the following settings
  • Make ZoomCamera child of cameras and change its position to (0.3755417 , -0.2398739 , 3.198844)
  • Now its time to putcrosshairs in place. We have to put transparent planes in front of cameras and then apply the textures. As plane available in unity is not transparent and it consists of lot of vertice so here I have a custom plane for this purpose. You can download the project and find how crosshairs work.
So this is how our game should look like by now


You can download the unity package from here  (PlayerPrefab is the updated one)

No comments:

Post a Comment