当前位置:网站首页>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 .
边栏推荐
- 每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
- Bugkuctf-web16 (backup is a good habit)
- Record the interesting process of using Xray for the first time
- 2837xd code generation - stateflow (3)
- C language: making barrels
- Matlab生成dsp程序——官方例程学习(6)
- ESLint 报错
- Matlab代码生成之SIL/PIL测试
- How to use pyqt5 to make a sensitive word detection tool
- 2837xd 代码生成——总结篇
猜你喜欢

Error reporting on the first day of work (incomplete awvs unloading)

Activity的创建和跳转

Required request body is missing: (cross domain problem)

上班第一天的报错(AWVS卸载不彻底)

Image recognition - data augmentation

三相并网逆变器PI控制——离网模式

TD联合Modelsim进行功能仿真

一次聊天勾起的回忆

The latest progress and development trend of 2022 intelligent voice technology

2837xd Code Generation - stateflow (4)
随机推荐
Timed thread pool implements request merging
Operation and application of stack and queue
Image recognition - data augmentation
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
BugkuCTF-web21(详细解题思路及步骤)
C语言之二进制与十进制
What are the waiting methods of selenium
Read Day5 30 minutes before going to bed every day_ All key values in the map, how to obtain all value values
Save video opencv:: videowriter
C语言之到底是不是太胖了
QT qlabel style settings
JDBC review
Bugkuctf-web24 (problem solving ideas and steps)
How to use pyqt5 to make a sensitive word detection tool
Mysql索引
Bold prediction: it will become the core player of 5g
因上努力,果上随缘
MySQL事务
Customize redis connection pool
Mysql默认事务隔离级别及行锁