当前位置:网站首页>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 .
边栏推荐
- Bugkuctf-web21 (detailed problem solving ideas and steps)
- 分布式锁的这三种实现方式,如何在效率和正确性之间选择?
- MySQL事务
- 个人经历&&博客现状
- 2837xd code generation - Summary
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- web安全与防御
- kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
- 并网逆变器PI控制(并网模式)
- 2837xd code generation - Supplement (2)
猜你喜欢

2837xd code generation - stateflow (4)

JDBC回顾

Enterprise level SaaS CRM implementation

2837xd代码生成模块学习(2)——ADC、ePWM模块、Timer0

Image recognition - Data Acquisition

MySQL事务

记录一下初次使用Xray的有趣过程

Off grid control of three-phase inverter - PR control

2837xd code generation - Supplement (1)

Tools used for Yolo object recognition and data generation
随机推荐
Cmake command - Official Document
cmake的命令-官方文档
Demand delineation executive summary
2837xd 代碼生成——StateFlow(4)
Is the C language too fat
2837xd code generation - stateflow (2)
每天睡觉前30分钟阅读_day4_Files
Alibaba / popular JSON parsing open source project fastjson2
int与string、int与QString互转
web安全与防御
Record personal understanding and experience of game console configuration
PI control of grid connected inverter (grid connected mode)
Discussion on improving development quality and reducing test bug rate
Image recognition - data augmentation
Timed thread pool implements request merging
Because of hard work, the fruit goes with fate
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
FragmentTabHost实现房贷计算器界面
Attack and defense world web advanced area unserialize3
How to use PHP spoole to implement millisecond scheduled tasks