About Unity FPS First person shooter game production (Special topic 10)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.