当前位置:网站首页>[unity entry program] creator kitfps: first person shooting 3D game
[unity entry program] creator kitfps: first person shooting 3D game
2022-07-27 11:36:00 【flashinggg】
Catalog
1 Add and load project resources
3 Add shots from the preform Targets
4.1 Create grouping relationship
4.2 Distinguish relative coordinates & World coordinates
5 Make a prefabricated part by yourself
5.1 Add rigid bodies and collision bodies
Unity Study the tutorial
I'm referring to B The one standing here UP Video learning , Very good ! Xiaobai is friendly !
1 Add and load project resources
Add project resources
This case uses Unity In the official resource store FPS Project resources of the game :Creator Kit:FPS.
Official resource address :Creator Kit: FPS | course | Unity Asset Store

Select Add to my resource

Load into Unity
stay Unity Hub Create a new one in 3D project , After opening, follow the following path
Top menu Window -> Package Manager -> My assets -> Download after Import It's done.


2 load Scene
Here we don't directly create a blank scene as before , Use the resources given by the imported project to create , Top menu bar FPSKIT -> Create new Scene, Choose a suitable place to store ( It's recommended to put it in Scene Under the table of contents ) You have created the scene you need now .
You can find , This scenario has been packaged with a series of things that need to be used , It provides very convenient resources .

By the way , The original intention of this small game is to further understand the process of game production , The code part has not been covered , Need to take Follow the tutorial , natural To learn .
3 Add shots from the preform Targets
The object here provides “ One's own ”—— Red blood cells and “ The enemy ”—— Bacterial monster , Respectively from the Prefabs Of Targets Drag in two categories Targets, The quantity and location are customized .

4 Manage game objects
4.1 Create grouping relationship
The same level ( scene ) There will be a lot of shooting aimed at the target , So many goals need to be grouped . stay hierarchy There is no folder in the view to manage so many game objects , We can create an empty game object as the parent object , Put the same scene Targets As children of the same parent , Pictured

4.2 Distinguish relative coordinates & World coordinates
- As the grouping relationship of the above parent-child relationship , Find sub objects Transform Components -> Position The coordinates have become different from before , This is because the coordinate system of these sub objects has been converted from the world space coordinates of the previous scene to the relative space coordinates
- meanwhile ,Targets Of this parent object Position, Will be One composed of all sub objects box The center of the whole
- So what if we want to synchronize the position of these sub objects with the previous world coordinates ? hold Target The coordinates of are changed to (0,0,0), Then adjust the position of the sub object , That's it .
5 Make a prefabricated part by yourself
Assets -> Creator Kit-FPS -> Art -> Models -> Characters, Find the preform GermSpike, Open this prefabrication and find that it is composed of three game objects

Let's not delve into what it originally contained .
Add it to the scene, try to run and find that it can't hit , Judge the lack of rigid body and collision body components , Therefore, it needs to be further improved .
5.1 Add rigid bodies and collision bodies
To achieve collision , You need to add rigid body and collision body components , rigid body -> Rigidbody, Colliding body -> Sphere Collider, At the same time, give the collider a fitting shape



5.1 add to Target Script
You need to hang another Targets There are scripts , Used to give life value 、 fraction 、 Sound components, etc .

5.3 Save as a new preform
Drag the object with the above components into the other two targets In the directory , It is preserved as a new prefabricated body , You can directly drag it into the scene when you need it .

6 Create a new scene
Here we use LevelLayout Script components , I don't delve into how it was written here , Just use it first .
open LevelLayout -> Click on Editing Layout,Add perhaps Remove To add a new scene .



7 Create doors and keys
To enrich the game , In the project, you can also add a door and a key to open the door to each level , These resources are available in Prefabs You can find it in the library , Add doors and keys and name 、 Just connect .

8 Modify the weapon
This weapon part is actually to select and add , So I won't go into details , Just watch the tutorial .
9 Add game end condition
I think the main thing to learn in this link is —— Application of collision body . Knowing that collision bodies can also be achieved Trigger the contact effect to execute the game end script Purpose , The key is to put Is Trigger The checkbox for is turned on .

Give him a box Collide with the body and hang a script at the end of the game .
thus , The game making process in the tutorial is all over .
10 Release the game
Click on File -> Build Settings, Select the platform you want to publish and Build Just go .

After saving :

summary
It took a day to learn how to make one 3D The process of the little game , To study the : Use of coordinate axes 、 Familiar with the right button +WASDQE Key to realize the first view movement 、 Set the game object 、 Hang script 、 Give the door and key 、 And setting the end conditions .
I learned a little , I will continue to learn about deeper programming later .
边栏推荐
- Digital triangle model acwing 1018. Minimum toll
- origin如何作一张图中多张子图是柱状图(或其他图)
- zabbix自定义监控项
- Interval problem acwing 906. Interval grouping
- Find the combination number acwing 888. find the combination number IV
- Digital triangle model acwing 1015. Picking flowers
- Maker paper data search training notes
- TapNet: Multivariate Time Series Classification with Attentional Prototypical Network
- Vscode establishes automatic search of header files under non engineering directories
- Installation and use of GTEST and gmock
猜你喜欢

数字三角形模型 AcWing 1027. 方格取数

Tree DP acwing 285. dance without boss

求组合数 AcWing 886. 求组合数 II

Quantitative industry knowledge summary

Knapsack problem acwing 9. grouping knapsack problem

Gaussian elimination acwing 883. solving linear equations with Gaussian elimination

TapNet: Multivariate Time Series Classification with Attentional Prototypical Network

Interval problem acwing 906. Interval grouping

美现首例孕妇猴痘病例:新生儿被注射免疫球蛋白,已安全出生

求组合数 AcWing 887. 求组合数 III
随机推荐
Beyond Compare 3 下一个差异段/向下搜索箭头 找不到了
LAN SDN hard core technology insider 24 outlook for the future - RDMA (middle)
开源flink有写holo的Datastream connector或者flink sql conn
Maker harmony OS application development training notes 01
LeetCode 03: T58. 最后一个单词的长度(简单); 剑指 Offer 05. 替换空格(简单); 剑指 Offer 58 - II. 左旋转字符串(简单)
Lazy loading of lists and pictures
USB 网卡驱动数据流
Caused by:org.gradle.api.internal. plugins . PluginApplicationException: Failed to apply plugin
The C programming language (2nd) -- Notes -- 1.6
剑指 Offer 笔记: T57 - II. 和为 s 的连续正数序列
数字三角形模型 AcWing 1015. 摘花生
LAN SDN technology hard core insider 13 from LAN to Internet
Modelarts image classification and object detection
The C programming language (2nd) -- Notes -- 1.7
(9) Shell I / O redirection
Game theory acwing 893. Set Nim game
Maker Hongmeng application development training notes 03
高斯消元 AcWing 883. 高斯消元解线性方程组
Maker Hongmeng application development training notes 02
记忆化搜索 AcWing 901. 滑雪