Current Unity Latest Version 5.6.3f1, I'm using 5.5.1f1
FPS first-person shooter game example
Scene Setup
1. Create a Unity Project project and file directory to save the scene
2. Charactor.unitypackage (74th) to import the character model and bullet fragment resource bundle
3. Create a plane plane,x and z elongate 10 times times, Assets\prefabs\person the protagonist model closer to the hierarchy view
4. Step.mp3 The sound of walking, the sound of shooting Shot.mp3, the plane map ground.jpg, the collimation map crosshairs.png (74th) Import the Resources folder
5. Drag the crosshairs.png directly into the scene view of the plane plane, automatically help us to generate a plane of material and associated
6. Create a cube, zoom in 4 times times, put in front of the protagonist model, Z set to 20
7. Configure a crosshair, the UI and the camera is proportional to the corresponding, so the center of the camera alignment is the center of the crosshairs aiming at, screen center, right-click---->UI---->image, named Crosshairs, Set Crosshairs.png's texture type to Sprite (2D and UI)
8. Drag the crosshairs.png into the source image property of the crosshairs node's image component, adjust the position of the crosshairs to (0,0,0), the center of the screen, Set Native Size
9. Configure a first-person camera, the eyes of human beings. is to drag the main camera to the person under person as a child node renamed eye, so you can follow the protagonist to move. Then set the camera's position to (0,1.5,0), just in the head
Fire shot.
10. Create a script open_fire, mounted under the person node, which implements the logic of firing. Edit---->project Settings---->input Configure three virtual keys Fire1---->mouse 0
FPS games usually do not have real bullets flying in the sky, it is generally achieved with a ray, there are real bullets do not matter.
Open Open_fire.cs
About Unity FPS First person shooter game production (Special topic 10)