I’ve been trying to make a dodge/ roll blueprint for my game. i cant find a good way to make it work. Thank you in advance for you help.
As with everything else in UE4, you need a roll or dodge animation, you need to code in the translation and you need to code in the initiation of the roll or dodge. If you want special effects you need to code in those as well. Maybe make custom materials or spawn particle systems. You might want to make the character invulnerable so you have to code that in as well.
For just the basic dodge without the animation or any effect you have to do 2 things:
- Bind a key that you want to use for dodging in the project settings and
- From that event translate the player in whatever direction you want to go.
The easiest would simply be to use a timeline node and in the output update the position of the character using set actor location.
If you want to make a better dodge mechanic you have to figure out what you want, think about how you can achieve it, make the animation or materials needed and then combine them.
Good luck.
Hey, not sure what part you are stuck with, but I want to say that Root Motion Animation is probably the best way to handle stuff like this.
Root motion handles animation as well as moving your character at the same time.
Hi. I dont know anything about coding so cant really do that. I made an animation for my character and did what you said about the timeline node. it works great. Now I just need a simplified version of the invulnerability frames.
Thanks for the help.
Invulnerability is simply calling a function that makes the character invulnerable. For example, make a boolean called Invulnerable. It should start as false. When you roll you call a function that sets the variable to true. Then, when the roll is done you can set the variable to false again.
Then, where you handle damage taken, simply use a branch where you only take damage if Invulnerable is false.
This is not very adaptive or powerful way to implement this, but it is the easiest to understand and it will get you started. You might want to look into the node Delay for some control over the duration.