当前位置:网站首页>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 .
边栏推荐
- Timed thread pool implements request merging
- Matlab代码生成之SIL/PIL测试
- 每天睡前30分钟阅读Day6_Day6_Date_Calendar_LocalDate_TimeStamp_LocalTime
- 道阻且长,行则将至
- Navicat 远程连接Mysql报错1045 - Access denied for user ‘root‘@‘222.173.220.236‘ (using password: YES)
- 2837xd code generation - stateflow (1)
- Activity的创建和跳转
- 图像识别-数据增广
- Tinyxml2 reading and modifying files
- Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
猜你喜欢
个人经历&&博客现状
Failed to configure a DataSource: ‘url‘ attribute is not specified and no embedd
分享一篇博客(水一篇博客)
Learn combinelatest through a practical example
Memories of a chat
The latest progress and development trend of 2022 intelligent voice technology
Matlab代码生成之SIL/PIL测试
zk配置中心---Config Toolkit配置与使用
Fragmenttabhost implements the interface of housing loan calculator
2837xd code generation - Supplement (3)
随机推荐
MySQL default transaction isolation level and row lock
2837xd代码生成模块学习(3)——IIC、eCAN、SCI、Watchdog、eCAP模块
Who is better for Beijing software development? How to find someone to develop system software
Read 30 minutes before going to bed every day_ day4_ Files
Alibaba / popular JSON parsing open source project fastjson2
2837xd code generation - stateflow (1)
Creation and jump of activity
ZK configuration center -- configuration and use of config Toolkit
How to install PHP in CentOS
2837xd 代码生成——StateFlow(2)
Image recognition - data augmentation
C language strawberry
kinect dk 获取CV::Mat格式的彩色RGB图像(openpose中使用)
BugkuCTF-web16(备份是个好习惯)
Alibaba /热门json解析开源项目 fastjson2
图像识别-数据标注
Save video opencv:: videowriter
JDBC回顾
图像识别-数据采集
Required request body is missing: (cross domain problem)