当前位置:网站首页>Illusion -- Animation blueprint, state machine production, character walking, running and jumping action
Illusion -- Animation blueprint, state machine production, character walking, running and jumping action
2022-07-02 09:53:00 【Qiao'an fish】
One 、 A term is used to explain
Sequence —— A movement .
Mixed space —— Mix different movements . Sort and play multiple sequences .
Animation blueprint —— Play different animations according to the status .
Two 、 Mix space to make walking and running moves
Because the movements of walking and running are relatively continuous , And they are all controlled by speed , So put standby 、 go 、 The three movements of running are mixed together .
1. Create mixed spaces
Right click —— Animation —— Mixed space 1D
Select the corresponding bone 
Renamed as “ Walk and run ”.
2. Make a walking and running action
Open the mixing space , In the asset details panel, change the name of the horizontal axis to “ Speed ”, The maximum axis value is changed to 500.
Will stand by 、 go 、 The running animation is inserted into the axis in turn .
Hold down ctlr Drag to see the action changes of the characters .
The mixed space is set .
3、 ... and 、 Animation blueprint
1. Create an animation blueprint
Right click > Animation > Animation blueprint 
Select the corresponding bone .
2. Add state machine
Drag and drop “ Output pose ” Of “result” Pin , Add state machine .

3. Add running status
Double click the state machine , Drag and drop “entry” Add state “ Walk and run ”

Click on “ Walk and run ” state .
The switching of walking and running posture is through the speed of the character , So here we need to input values for the output posture .
Mix the space on the right “ Walk and run ” Drag in and out of the pose “result” Connected to a .
Drag and drop the mixed space “ Walk and run ” Of “ Speed ” Pin , Promoted to variable “ Speed ”.
Then we need to get the speed of the character's movement in the event chart bar , OK, pass this value to the blending space to control the output posture .
Open the event chart , Drag and drop “ Event blueprint update animation ” New execution pin of “?Is Vaild” function ——“ Try to get Pawn The owner ” The return value of is the same as “?Is Vaild” The input type of .
- ?Is Vaild—— Determine whether the object is valid . That is, when the player is out of control , It is invalid .

Drag and drop “ Try to get Pawn The owner ” Return value new function “ Get speed ”(get velocity)
Get the speed of the current player .
Because the value of the coordinate axis of our walking and running mixed space is of floating-point type , And the speed obtained is the vector type , So we need to switch again .
Drag and drop “ Get speed ” The return value of , newly build “ Vector length ” function (vecot length)
Hold down ctrl Drag and drop “ Speed ” Variables and Is Vaild Connected to a ,“ Vector length ” The return value is connected to the speed pin .
4. Add standby mode
Double click the state machine , stay entry Add a standby state between walking and running .
Standby state and running state are connected , Because the two need to switch each other .

We still control through the speed variable .
- Speed >10, Switch to running state .
- Speed <10, Switch to standby mode .
A. standby — Walk and run
Click the switch button from standby to running .
Press ctrl Drag the speed variable into 
Drag speed pin added “ Greater than ”(>) function , The input values 10
The greater than function execution pin is connected to the result function .
B. Walk and run — standby
Click the go run standby switch button .
Press ctrl Drag the speed variable into 
Drag speed pin added “ Less than ”(<) function , The input values 10
The less than function execution pin is connected to the result function .
5. Add jump status
There are three states in jumping : Take off 、 Jump up 、 Fall
The switching between jumping and running depends on whether the character is in “ Floating space ”, Because there will be cases of canceling the jump in advance , And the switching conditions between these three states are different , So you can't mix these three actions directly , Three states need to be created .

- Floating space , Walk and run —— jump .
- Not floating , Jump up —— Fall .
- Playing time <0.01, Fall —— Walk and run ; jump —— Jump up ( That is, play the next action )
A. Walk and run — jump
Click go, run and jump .
Drag and drop can enter transition The pin is promoted to variable , Renamed as “ Whether to jump or not ”.
B. jump —— Jump up
Enter jump action , Create a new action “ The rest of the time ” function .

Drag the remaining time to return the value , Create a new less than function , The input values 0.01.
The execution pin of the less than function is connected to the result function .
C. Jump up —— Fall
Drag in “ Whether to jump or not ” Boolean variables , Connect “ be equal to ”(=) function .
That is, switch posture when it is false .
use “ It's not equal to ”(not Boolean) The function has the same effect .

D. Fall — Walk and run
The remaining time function of the falling action , Less than 0.01 Switch state when .
E. Get floating status
Now we need to go back to the event chart , Get the current floating state of the character , Then control the state switching by whether to jump variables .
Drag and drop “ Try to get Pawn The owner ” Return value , newly build “ Get mobile components ” function .
Drag and drop “ Get mobile components ” Return value , newly build “ Falling ”(Is falling) function 
Drag in “ Whether to jump or not ” Variables and “ Speed ” The execution pin of the variable is connected ,“ Falling ” The return value of is the same as “ Whether to jump or not ” Connected to a .
Complete logic :

The animation blueprint needs to be adjusted in two parts : State machine 、 Event chart .
The state machine is three levels nested :
1. State tree ( Similar to the behavior tree )
2. This state is animated
3. The logical relationship of state switchingSome variables are needed to control the state switching , At this time, you need to connect blueprints in the event chart to enter values into variables .
边栏推荐
- 2837xd 代码生成——总结篇
- 逆变器simulink模型——处理器在环测试(PIL)
- Matlab生成dsp程序——官方例程学习(6)
- 每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
- 2837xd code generation - Supplement (1)
- Beats (filebeat, metricbeat), kibana, logstack tutorial of elastic stack
- 阿里云Prometheus监控服务
- C语言之数据插入
- Alibaba / popular JSON parsing open source project fastjson2
- zk配置中心---Config Toolkit配置与使用
猜你喜欢

JDBC回顾

2837xd 代码生成——StateFlow(4)

YOLO物体识别,生成数据用到的工具

Image recognition - Data Cleaning

2837xd code generation - Supplement (2)

Mixed development of uni app -- Taking wechat applet as an example

ESLint 报错

2837xd Code Generation - stateflow (4)

How to install PHP in CentOS

Timed thread pool implements request merging
随机推荐
Required request body is missing: (cross domain problem)
zk配置中心---Config Toolkit配置与使用
图像识别-数据标注
Navicat remote connection MySQL reports an error 1045 - access denied for user 'root' @ '222.173.220.236' (using password: yes)
Record the interesting process of using Xray for the first time
web安全与防御
Skywalking理论与实践
In SQL injection, why must the ID of union joint query be equal to 0
图像识别-数据增广
JDBC review
2837xd代码生成模块学习(1)——GPIO模块
职业规划和发展
ZK configuration center -- configuration and use of config Toolkit
三相并网逆变器PI控制——离网模式
阿里云短信服务
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
MySQL事务
JDBC回顾
C语言之分草莓
2837xd 代码生成——补充(2)