当前位置:网站首页>[unreal] key to open the door blueprint notes
[unreal] key to open the door blueprint notes
2022-07-02 10:00:00 【Qiao'an fish】
【 Unreal Engine 】UE4 Automatic door and manual door opening blueprint teaching
Use the previous automatic door opening logic .
Press the specified key , Open door .
The principle is : Game player F build —— Player collision detection —— If the player overlaps with the box shaped collision of the door —— Open door
There are two technical points involved :
- Blueprint communication —— Player blueprint detected door , Tell the door blueprint to execute the opening event .
- collision detection —— Keystrokes , Traverse the objects that players collide , If there is a door , Then execute communication .
One 、 Establish blueprint communication
Blueprint interface —— Blueprint communication bridge
Right click > The blueprint > Blueprint interface .
Create a new function in the blueprint interface If_Open.
At this time, the blueprint interface is set , You can close the blueprint interface window .
Open the interface in the blue diagram of the door : Class settings —— Interface > Add the function just now If_Open
Two 、 Gate logic
1. Press the key to open the door
Open the door blueprint .
add to IF open event , And The opening event is connected .
Now the effect is that players press F Open door , The rear door automatically closes after entering .
If all have to be closed by pressing the key , Record the state of the door , Determine the switch according to the state .
2. Player blueprint settings
Open the player blueprint .
Right click to add F event
F Events are directly connected IF_open Interface , At this time, the direct compilation reports an error , We must give a goal .
3. Player collision detection
Use player capsule for collision detection , For collision Actor Traversal , If there is a door , Then directly execute the door opening event .
Click the capsule component —— Add components to start overlapping events 、 Component end overlap event
Add an array variable to store collisions Actor Information :
- When overlap starts —— Add information
- At the end of the overlap —— Delete the information
When dragging components to overlap “other Actor” The pin is promoted to variable .
Change the variable type to array , Change of name , Delete —— Hold down ctrl Drag variables from the left to the blueprint , Create this variable key .
Drag to open the door Actor Key and create a new ADD“ Add to array ” function —— When components begin to overlap Other Actor Pin 、 The execution pin is connected to the function added to the array .
If the player collides with this object , Then put the Actor Add to the one that can open the door Actor Array .
Drag to open the door Actor Key and create a new Remove“ Remove from array ” function —— When the component ends overlapping Other Actor Pin 、 The execution pin is connected to the function added to the array .
If the player does not collide with this object , Then put the Actor From the one that can open the door Actor Remove from array .
Complete blueprint of collision detection .
4. Collision detection information traversal
At this time, we have the information of the collision object , Next, choose from the inside .
Create a new one that can open the door Actor key , Drag and create For Each Loop Traversal function ——F The event is connected to the traversal function execution pin —— Traversal function and If Open Connected to a
The complete logic is : Press F—— Pair collision Actor Array traversal —— There is a door —— The door blueprint executes the opening event .
Why use arrays , It should be that players may encounter multiple at the same time Actor, Or before leaving the last Actor When they meet new Actor.
边栏推荐
- Cmake command - Official Document
- 【虚幻】过场动画笔记
- C语言之最小数
- C语言之数据插入
- The latest progress and development trend of 2022 intelligent voice technology
- C语言之到底是不是太胖了
- Matlab代码生成之SIL/PIL测试
- Error reporting on the first day of work (incomplete awvs unloading)
- QT信号槽总结-connect函数错误用法
- [ue5] animation redirection: how to import magic tower characters into the game
猜你喜欢
MySQL default transaction isolation level and row lock
Large neural networks may be beginning to realize: the chief scientist of openai leads to controversy, and everyone quarrels
MySQL index
QT QLabel样式设置
2837xd 代码生成——补充(2)
Sil/pil test of matlab code generation
Introduction and prevention of penetration test
ZK configuration center -- configuration and use of config Toolkit
【虚幻】过场动画笔记
【UE5】AI随机漫游蓝图两种实现方法(角色蓝图、行为树)
随机推荐
BugkuCTF-web24(解题思路及步骤)
阿里云短信服务
C language programming problems
C语言之判断直角三角形
Cmake command - Official Document
2837xd code generation - stateflow (2)
Junit5 supports suite methods
2837xd Code Generation - stateflow (4)
Activity的创建和跳转
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
2837xd 代码生成——StateFlow(2)
职业规划和发展
在SQL注入中,为什么union联合查询,id必须等于0
Alibaba / popular JSON parsing open source project fastjson2
2837xd code generation module learning (3) -- IIC, ECAN, SCI, watchdog, ECAP modules
c语言编程题
Image recognition - data annotation
Tools used for Yolo object recognition and data generation
MySQL index
2837xd code generation - stateflow (4)