Introduction
I finally started to set up the animation. I am about to enter the character blueprint and the animation blueprint to set up the state machine and eventgraph. This is something I haven’t done before. I hope I can solve it smoothly.
Process
At first I found that my blank map was missing, and I was a little panicked. When I retrieved it with the project setting, I found that only folders are displayed on the left side of the content browser, and files that are not folders are displayed on the right side.
Next I created my old friend blend space1D. I believe anyone who read my previous blog will know that I already know it well. The official tutorial I read is still the old version of UE4. I can’t find where the panel is. Fortunately, another tutorial also shows the same content.
My character can now move! But it was a bit strange when switching from idle to walk, mainly because of the position. I made it in accordance with the official project, and I don’t know why the foot chose to move like this. But this is also very cool!
Then I will create an animation blueprint, here is a tutorial that introduces state machines! He said so well! Make my logic clearer!
https://www.youtube.com/watch?v=NYFeFUxU6DI&t=615s
Entering the animation blueprint, first I will see the event graph and the anim graph. The event graph mainly uses nodes to tell UE4 our operations, and the anim graph is the place where the state machines are connected and the place to show.
Create a state in the animgraph, name it locomotion, and then continue to add a state, which is the state that controls idle, walk, and run.
Enter this state, drag my blend space1D into it, and right-click speed to promote it to a variable. This is telling it that Speed will be controlled by the input, not a fixed value.
Add another three states separately, and drag in the animation that I have made. The button on the arrow is for inputting conditions, please refer to the figure of state machines above for details.
Because I am using the Chinese version of unreal engine4, I can only input Chinese to find the node I want. This is really too much trouble, even if I check the manual, it is useless. Fortunately, it took some time for me to find it. For a while, I didn’t know whether to continue to use the Chinese version or change to the English version.
And judging whether to play jump loop and jump end needs to understand a logic, whether the current playback time of this animation is less than X%, if it is less, continue to play until it reaches X%, and once it is greater than, play the next state. This is how this graph is written.
Originally 0.1 was used, which is equivalent to 90%, but the reading time is not enough and there will be problems, so I changed it to 0.5, which is equivalent to continuing to the next state in the middle of the playback, which will actually destroy the smoothness of the animation Sex, this also shows that next time I will make this animation longer.
Be sure to click the compile in the upper left corner, and click as long as the data is updated, so that you can watch the real-time effect. Now that this state can be run, it is up to us to give it a judgment input.
I entered eventgarph and put in the following nodes. This is to let the character have an initial setting, including judging whether he can jump, walk or run. I have marked the specific function in the figure:
https://www.youtube.com/watch?v=O4LNvsFyuLM
Then return to my character blueprint, where I can use the animation blueprint (you can also load my animation asset directly). After loading, I can see that the character walks out of the collision body. I don’t know if this will cause a problem, so I decided not to adjust it.
This page is to set the physical attributes of the character itself, such as the speed of walking and running, the height and resistance of jumping, and so on.
If I want the camera to follow the rotation of the character, I have to cancel and select the following options:
For me as a newbie, the most strange thing is to add eventgraph to the character blueprint! Here is the input selection for this role. Before this, I have set the input in the project settings, so I can directly use event. But fortunately, the official tutorial is very clear:
https://www.youtube.com/watch?v=IIIpZ_7RaEM
Don’t forget to compile!
Because I have already created a game mode, I found that my character can move! Although he can’t spin yet, there are problems with jumping up.
I first move the character down with reference to the collision body in the character blueprint, so that it won’t be suspended in the game. Then I found out that I didn’t have the option of switch on, so the character could not be rotated. After adjustment, there is no problem!
Regarding the question of jumping, I asked Zhu, and he asked me to change the jumping Z speed to half so that I would not jump so high, so I set it to 250, and sure enough, the jumping is fine!
This is awesome! ! !
Conclusion
This time I set up a blueprint for walking and jumping, but running has not been set yet. But my character can already move! It’s really cool!
It’s just that there are some graphs that I don’t really understand why I want to do this. Maybe I can understand the logic after doing it a few times. After all, I’m still a novice.