Unreal Engine 5 RPG Tutorial Series - #12: Target Lock and Dodge Roll
Summary
TLDR在这段视频脚本中,制作者带领观众继续深入角色扮演游戏(RPG)系列的教程。首先,他们解决了玩家在下蹲时胶囊碰撞体不缩小的问题,通过调整第三人称蓝图中的胶囊组件的高度值,实现了更自然的下蹲动作。接着,通过启用摄像机滞后功能,改善了摄像机移动的平滑性,减少了“咔嚓”声。此外,制作者还介绍了如何设置目标锁定系统,使用户能够在战斗中锁定敌人,以及如何实现躲避动作,增加了游戏的动态性和战斗的流畅性。最后,他们还讨论了如何通过输入动作和动画蒙太奇来实现躲避输入,并确保在攻击过程中不能执行躲避动作。整个教程内容丰富,步骤详细,对于希望在Unreal Engine 5中创建RPG游戏的开发者来说,是一份宝贵的学习资源。
Takeaways
- 📺 在RPG系列教程中,将设置教程锁定系统,以便在战斗中锁定敌人,减少玩家的担忧。
- 🔄 将设置一个翻滚系统,允许玩家向左右翻滚来躲避敌人。
- 🛡️ 通过调整胶囊碰撞器的高度,实现角色蹲下时碰撞体积的缩小。
- 🔩 利用事件图和胶囊组件,调整角色蹲下时的碰撞高度,以避免穿模问题。
- 📏 通过设置胶囊组件的半高度,实现角色蹲下时的碰撞体积变化。
- 🤸♂️ 创建了一个翻滚动画,并导入到RPG角色中,通过动画蒙太奇实现翻滚效果。
- 🎯 实现了目标锁定功能,使用球体追踪来检测前方的敌人,并锁定视角。
- 🔄 通过时间轴和插值函数,平滑地过渡胶囊高度和网格偏移,以改善蹲下和翻滚的动画效果。
- ➡️ 使用输入动作和集合来绑定目标锁定和翻滚的新按键输入。
- 🚫 通过检测是否正在攻击来阻止在攻击过程中执行翻滚动作。
- 🔄 对于目标锁定,实现了锁定和解锁的逻辑,允许玩家在锁定敌人后取消锁定。
Q & A
在视频中提到的RPG系列教程是关于什么的?
-视频中的RPG系列教程是关于如何在游戏开发中设置角色的教程锁定系统和翻滚系统,以便在战斗中锁定敌人并进行躲避操作。
为什么在角色蹲下时胶囊碰撞体会出现问题?
-当角色蹲下时,胶囊碰撞体的高度没有相应减小,导致角色模型与地面发生穿透,这是因为胶囊组件的高度没有根据角色的蹲下动作进行调整。
如何调整胶囊碰撞体以适应角色的蹲下动作?
-通过在第三人称蓝图中调整胶囊组件的高度值,当角色开始蹲下时减小高度,当角色站立时恢复到原始高度。
为什么角色在蹲下时会感觉动作很突然(Snappy)?
-这是因为胶囊高度的立即改变导致的,可以通过启用相机滞后(Camera Lag)和调整相关参数来使相机移动更加平滑。
如何实现目标锁定功能?
-通过在第三人称输入动作中创建一个新的输入动作,使用球体追踪(Sphere Trace)来检测前方的敌人,并在检测到带有'damageable'标签的敌人时锁定目标。
如何取消目标锁定?
-在目标锁定的逻辑中添加一个条件检查,如果目标锁定变量为空,则取消锁定,允许玩家自由控制相机。
视频中提到的翻滚动画是如何实现的?
-通过导入特定的翻滚动画资源,并在第三人称角色蓝图中创建一个新的输入动作来触发这个动画,同时确保在动画播放期间不能进行攻击。
如何避免在攻击过程中执行翻滚动作?
-通过检查攻击系统组件的'is attacking'属性,如果角色正在攻击,则不允许执行翻滚动作。
为什么需要设置一个'not dodging'的变量?
-为了避免角色在执行翻滚动作的过程中再次进入翻滚状态,需要一个标志变量来表示角色当前是否正在翻滚。
如何使翻滚动画的过渡更加平滑?
-通过在动画蒙太奇(Animation Montage)的Blend Out设置中使用Cubic曲线,并调整Blend Out时间来实现更平滑的过渡效果。
为什么有时目标锁定会失效?
-可能是因为追踪通道(Trace Channel)设置不正确,改为使用'Physics Body'而不是'Visibility'可以提高检测的准确性。
Outlines
😀 角色蹲伏与摄像机锁定系统设置
本段介绍了如何在RPG系列教程中设置摄像机锁定系统和翻滚躲避机制。首先,通过调整胶囊碰撞体的高度来实现角色蹲伏效果,解决了蹲伏时胶囊碰撞体不缩小的问题。接着,通过启用摄像机延迟和调整参数,使摄像机运动更加平滑,减少了蹲伏时的“快照”效果。
🎮 摄像机平滑跟随与高度调整
详细说明了如何调整摄像机跟随玩家的平滑度,通过设置摄像机延迟参数,让摄像机在玩家蹲伏或移动时更平滑地跟随。同时,还讨论了如何通过改变胶囊碰撞体的高度和添加偏移量来优化角色模型与地面的交互,避免角色穿模问题。
🎯 实现目标锁定与摄像机控制
本段讲解了如何创建一个新的输入动作来实现目标锁定功能。通过使用球体追踪技术,检测玩家摄像机前方的敌人,并在检测到可攻击对象时锁定目标。此外,还介绍了如何通过设置控制器旋转来实现摄像机的锁定视角,并添加了偏移量来调整摄像机的视角高度。
🔄 摄像机解锁与动画调整
讨论了如何实现摄像机的解锁功能,允许玩家在锁定目标后通过再次按下指定按键来解除锁定。同时,还涉及了动画的导入和调整,如何通过调整动画蒙太奇和动画蓝图来实现角色的翻滚躲避动作,并确保在攻击过程中无法执行翻滚动作。
🛡 解决碰撞检测问题并完善躲避机制
本段内容集中于解决角色在执行躲避动作时的碰撞检测问题,确保角色的胶囊碰撞体和武器不会产生错误的碰撞。此外,还讨论了如何通过修改输入动作和动画蓝图来完善躲避机制,包括设置躲避动作的布尔变量,以及调整动画蒙太奇的混合时间和退出策略。
🔄 锁定机制的进一步优化
最后,本段内容对锁定机制进行了进一步的优化,通过调整追踪通道和对象类型来提高锁定敌人的准确性和稳定性。同时,还提到了如何通过社交媒体和Discord服务器与开发者社区互动,获取帮助和分享进度。
Mindmap
Keywords
💡RPG系列
💡教程锁定系统
💡翻滚系统
💡胶囊碰撞器
💡摄像机平滑移动
💡目标锁定
💡动画蒙太奇
💡根运动
💡输入动作
💡碰撞检测
💡动画混合
Highlights
介绍了如何在RPG系列教程中设置教程锁定系统,以便在战斗中锁定敌人,减少玩家的担忧。
设置了躲避系统,允许玩家向左或向右躲避敌人。
讨论了当玩家蹲下时胶囊碰撞器不缩小的问题,并提供了解决方案。
通过第三人称蓝图调整胶囊组件的高度,以实现蹲下时角色大小的变化。
解决了角色蹲下时胶囊碰撞器过低和穿地的问题。
启用了摄像机滞后功能,使摄像机移动更加平滑,减少了蹲下的突兀感。
调整了摄像机滞后参数,使游戏运动更加流畅。
通过事件图调整胶囊高度和网格偏移,以实现蹲下时角色的正确碰撞和视觉效果。
使用时间轴和插值函数实现蹲下动作的平滑过渡。
创建了新的输入动作,用于实现目标锁定功能。
使用球体追踪和通道检测来实现目标锁定,允许玩家锁定并关注敌人。
实现了目标锁定的取消功能,允许玩家在锁定状态下通过再次按下按键来解除锁定。
讨论了如何避免角色模型在躲避时与地面发生穿透的问题。
导入并设置了躲避动作动画,增强了战斗的动态性和玩家的操作体验。
通过动画蒙太奇和输入动作的结合,实现了在战斗中可以执行躲避动作的功能。
确保了在执行躲避动作期间,玩家不能连续躲避,增加了游戏的平衡性。
调整了动画蒙太奇的混合时间,使躲避动作的过渡更加平滑。
优化了目标锁定的检测机制,通过物体类型而不是通道来提高锁定的准确性和稳定性。
鼓励观众如果觉得视频有帮助,可以点赞和订阅频道,加入Discord服务器以获取更多支持和交流。
Transcripts
what's up guys welcome to new unview
engine 5 tutorial today we'll go ahead
and continue on with the RPG series
we'll go ahead and set up the tutorial
lock system so we can lock the camera
into the enemy while we are you know in
combat and it will just enable us to
have a bit of less worries when we are
fighting and so on and also we'll go
ahead and set up a Dutch and roll system
so we can dodge your enemy to the right
to the left and so on it's gonna be a
very easy build for so let's get started
all right so the first thing that we are
going to go ahead and do is basically do
one thing that you guys have
um comment me and also let me know in
the Discord and right now basically when
you go ahead and Crouch and your capsule
uh collider doesn't go ahead and Shrink
so let's say that I was going ahead and
getting this thing over here I'm gonna
duplicate real quick you don't have to
do this okay guys this is to Showcase uh
what I'm saying right now
and make it let's say like this uh so
right now I cannot pass but if I'm
Crouch okay that's a bit too low maybe
like this so like this of course I
cannot pass but if I crouch I should be
able but I still cannot pass and this is
because of the capsule component so we
have to go ahead and basically decrease
so let's go into the third person
blueprint over here okay and we can also
go ahead and you see it real quick
if I enable capsule component so we can
see it right when we play the game so
come on look let me go into the viewport
and if you select the capsule component
over here I can go into details and
search for the hidden in game and use it
safely so now you will see it on game as
you can see so basically when I crouch
you can see that it still is like with
the height of what the normal player
would have and of course we don't want
them we want to go ahead and change it
depending where Crouch or not
so let's go quickly into the event graph
I'm gonna go into our Crouch and you can
see that we have all our stuff over here
and basically we have to go into here
basically when we start crouching so
let's get all this right over here so
basically uh from the camera and also
the sprinting
let's get to this and put a bit to the
right so we have some space so basically
let's go ahead and get our capsule
component and the value that we have to
change is this so set
uh half height and this is basically the
height so now we can just plug this here
plug this here copy paste this plug this
here and plug this here beautiful okay
let's put this over here so we can save
it better and great you can now put this
here it's a bit better
okay so right now the uh capsule height
The Hub height is 90. so let's say that
of course when we go and exit our
crouching we need to set it back to 90.
but when we start crouching let's set it
to around let's say 40. okay and now
you'll see that the capsule with the
crease and also yes I need to connect
the capsule component to the node
because I duplicate it okay so now you
will see that when I crouch the capsule
indeed goes ahead and shrinks but
basically there are a few problems and
it's first of all 40 is to low and then
our character is going through the
ground and so on and you know there are
many reasons on why this is happening if
you go here you can see that if I put it
into 40
exactly the feet will be on the ground
and this is not really what we want so
what we have to do is find a middle
point so let's say 50
16
5 I think will be kind of the point over
there so let's head to let's do 60 okay
let's go put it back to 90 of course and
then let me close to these steps and
open again the event graph
uh this is a big cleaner
this year okay let's go and put this
around 60 we said so now of course we
can go ahead and Crouch but if we have a
problem and is that of course our um
oh we have two problems as our mesh is
going through the ground and then also
it's very Snappy there's a snap as you
can see
um so there are a few things that we can
go ahead and change over here first of
all let's quickly go ahead and resolve a
bit of the
um snappiness so what we can do is
enable camera lag and it's just
basically making the camera movement
much smoother as it will add a nice
interpolation with a small delay in in
its movement so we're going to the
camera boom and we search for a lag you
will see here enable a camera lag so if
I enable this and compile you will not
notice a huge difference when we play
the game right on but if I crouch now it
is not so snobby I don't worry we'll
increase the less snappiness in a second
we'll fix one more thing we'll basically
do this slowly now directly set the
height but just to show you a bit how
the camera like works if I put this
value into let's say instead of 10 1
and go here you can see that now it
takes much more for a camera to follow
the player so basically it's just making
things smoother depending on the spot
the higher the quicker it will be so
around 10 works pretty good honestly I
like it and also our movement in our
game will be also smoother as you can
see like it's just a bit smoother it
gets a bit better and also we can just
increase it maybe a bit let's put it to
12 you know you can play with the
settings and so I think it's 12 will
work pretty good and then also when we
Crouch it's less Snappy but still it is
a bit Snappy so we have to go ahead and
also fix that but then also in our half
height we have to change this because
right now if we put this instead of 90
to 60
okay a smaller but then we'll have to
increase our height so we have to put it
back into here right until the the foot
over here so what we can do is just add
30 because it's just basically the
difference between the two so we can
just add an offset of 30 inter mesh when
we change let's go back into the van
graph and right after this is put once
again our camera movement well uh
distance over here
and we're gonna get our mesh and
basically we're gonna use a note which
is ADD offset it's gonna be a local
offset okay it's a pretty big note but
we're only going to use one more thing
which is here so in 30 so in the set at
30. and then I'm going to do the same
copy and paste it
but
over here and now plug in the mesh and
then this will be minus 30 because we
want to subtract it and now you will see
that when I crouch it is correct and
also I forgot to put this back into an
idea at the start sorry about that for
this 90 there we go
and then you can see that now it is
correctly but there's still this uh
snappiness into it so now also I will be
able to go through great pretty pretty
cool as you can see and then when I'm
like this now so that's exactly what we
want great so now I want to do is
basically slowly with also a timeline
changes value
so again this is very messy so let's go
ahead and make some space into it so
let's get all this and just put a bit up
so we can put this one a bit up and the
basically move this one here we go
because there's a lot of things going on
let's get this move it here
this here
and the Sears are about this guys but we
need to do some cleaning because holy
crap this is pretty
messy right now here okay
uh much better great so we have to add
some timeline into this too so just go
ahead and right click add
timeline over here and then this will be
the uh capsule
something like that let's go ahead and
double click to enter it and now it's
gonna add a float and this is gonna be
our new height
okay it's gonna be a flow track and now
we want to set the length to be let's
say how much does this take in the other
cam it is one second all right so we'll
do the same let's put it well actually
let's do 0.5 because I think it's gonna
be better so let's put 0.5 and then add
a key the first key let's selected and
put the time to be zero as it will be
restored and the value as zero but then
let's add another key and this time the
time will be at 0.5 which is where it
ends and then the value I won and then
you will see that it will just go uh in
a linear equation here
so we can just now go ahead and play
this from the start
right actually before we set our capsule
height so move this a bit and let's get
this front plate from start and then on
update we'll go ahead and put this here
basically both of these ones the things
that we don't want to also basically do
all this in the update because this is
basically separate
so we want to do is from here do a
sequence
and yes the first one will go from here
but the second one will go all the way
to here to the branch so we don't have
to do anything in there so double click
put the serum
and put this one here
so yeah extremely messy
but we don't have a lot of room
um but but there we go we can make it a
bit better great
so that's what I'm going ahead and
working
um and now from this we need to do
exactly the same another sequence
the this one will go into the reverse
okay now for Matt let's just reverse and
this one will just go straight into the
branch and now we can disconnect this
one okay because if not
it will go ahead and do so there and yes
I just forgot we can just delete this
both ones over here uh no this one
because now if we do the reverse it will
go back into Norm so great everything
going crazy crazy good uh so let's get
the height and let's do a lurk and
you'll see a float lurp so now we can
hold Ctrl and move the a into the alpha
so now we can transition between two
values which in this case will be from
90
two
um 260. and now we can just plug that
into the half height capsule and then
we'll need to do the same with the local
offset so we're gonna get another lerp
blurp float and then the mode into the
alpha with control the first point will
be uh yes 30 and then it's going to be
minus 30.
and I'm gonna plug that into there but
we need to right click in here and split
it so we can just put it into the set
axis
and that should work exactly like it is
always but with a nice
okay so you can see the capsule is good
but the uh is incorrect we don't have to
basically add a local we have to
transition between new two sorry so now
in the mesh
we can just do set I was a location
set relative location for the image okay
I added two meshes okay we're going to
delete this one because now it's not
adding now it's just setting because
it's better for us again right click
split it and put it on the Zed but now
we have to manually find the position so
at the start of will be minus 89
so let's plug that in here minus 89. and
then the second one will be basically I
was a plus 30. so it will be a minus 59
okay so minus 59 there you go a lot of
calculations here but there we go so now
there you go we have a smooth transition
between the two
ah okay
thankfully okay sorry about that guys if
I confuse some of you guys I was mainly
because it was a bit of a spaghetti gold
there but basically let me real quick
recover it so basically until here we
are making a sequence so it will just do
the same of the camera it will just
continue like normal okay nothing will
go ahead and change
but
um in the in the first one here it will
do the new thing so basically we're
doing a small transition here and we're
getting this a transition from 90 to 60
and we are setting this new height so
slowly it will do it and then in here
we're basically changing from this
location instead which is the normal one
into the new one basically I'm applying
it for mesh and then one is in the not
crouching we will just do it from the
reverse because it will just go you know
to the other values and then here we
just continuous normal to the camera so
yeah sorry about that but done we can
move on into the target lock template so
let's go ahead and do so but let's
create a new input so let's go into the
third person inputs and then actions and
now we can just go ahead and right click
go into input action it's going to be EA
underscore and then here we can say uh
it's going to be
um Target lock
and we don't have to even open it you
save it and close it great let's go now
to the collection and on here we can add
it so new mapping and this will be our
and Target lock and then we're gonna
assign a key in this case we can select
it and say tap okay let's say that with
tab we can go ahead and entire lock of
course you can choose whatever key you
want let's close it and now we can just
go down over here into the blueprints
let's find a nice space right over here
let's say on the Sprint team right click
it's going to be e a underscore Target
lock the first one with the arrow here
and basically in startup we can start
making our calculations so we want to do
is make a sphere Trace
by Channel basically this would use
great and invisible right cast and
movable sphere
um forward okay well right now not
forward but we'll set it so it's forward
so the starting point will be actually
from the camera so let's get the full
camera and then say get weld location
and now you can plug that into the start
over here
great now the end point will basically
be well let's get the rotation okay the
world rotation and let's get the forward
axis basically where the camera is
looking at and now we can use multiply
this value by a number so it's going to
be the distance that will be able to
detect an enemy but we have to right
click over here and convert this into a
nice float a nice number and in this
case it will be let's say around 500.
and now we need to do is get this and
just add this into this so we'll get the
direction and this will be the end point
so the certain point will just be in our
camera and the endpoint will be 500
um of distance in front of our camera
and then the radius let's set something
as
125. first you can play with the
settings once we have it going on and
then the the bug type let's say it's
gonna be for duration so we can preview
it so naturally we can start proving it
if I compound and go here I can press
Tab and you can see this um sphere so
this is where the uh
it will detect the enemies so if I go
here I will say Tab and then if it
detects the enemy it will go there
so great uh everything is going ahead
and working so now we need to go ahead
and just make sure that we have hidden
something so if we have hit something we
can now get the out hit and break it so
we can get all the details about the
object so we want to get the hit actor
and make sure that it has the tag
damageable
which is the one that we create for the
enemy in this case just the dummy so
let's go ahead and just check if it's
spell like that Ctrl e to open the dummy
and now we can go into the class
defaults and search up attack and then
is this one damageable so I'm just going
to copy and paste this is the same
spelling just in case but it should be
completely fine so ever any tag that has
this any actor that has a stack will be
able to Target lock into it so it's
gonna be cool and very Dynamic so get
the uh out here and make another Branch
this will be a separate Branch over here
great so
uh now want to do is basically tire lock
into that one so let's save the hit
actor into a variable right click and
then promote to Bible and this will be
the actor
to Target lock okay and now oh just said
over here in the true so if this is true
okay it has the tag damage book we want
to go ahead and set it as a new variable
great so now we can compound and save so
now we will detect our enemy and save it
in a variable but of course nothing more
we'll go ahead and have him
so we need to do now is go into the van
tick and do so some things over there
let's go here and move all that and to
the right which is actually in a stamina
but it's okay we'll move in later on and
make a sequence so we'll do the stamina
things over here and then another point
we'll do our basically our um our new
stuff so let me just wrap it a bit let's
proceed to comment it it's going to be
Target lock let me put the T
go and let's apply our preset over here
great so this is basically perfect
um so in here what we can do is now make
sure that we have a a an actor tutorial
lock if so basically we are Target
locking so let's get the actor and let's
right click and convert this into a
validated kit so basically if it's valid
it means that this variable has our
actor that we have just detected saved
on so if it's true basically we need to
start lock so we want to do is basically
get the controller
okay and to get the control and now we
need to do is set the control rotation
so this will basically set up and
override the whole rotation of the of
our player
so now the new rotation will be
basically a find local rotation the
starting point will be our current
location so get actual location but our
destiny our Target will be the actor
location of
our enemy so now we can just plug that
into Target I know this is very messy
right now because overlapping with our
code let's put it here great that's a
bit better we'll move the advantage
later on
um so now if we compile you will see
that actually it should be working so if
I go here and press tab
and I get a bit closer I need to change
the distance you can see then I I cannot
move with my mouse the camera but it
will be tire locked into the enemy great
so now we need to do some more things
first of all you notice that it was the
camera was very down so then that we can
do is basically apply an offset so let's
go and break this pin and right click
and split it on both of them
okay and then actually we don't have to
split it so you can just drag this and
basically subtract it so we're gonna
subtract an amount of distance let's say
Indie said 100. so basically now the the
thing will be upper and also let's
increase a bit the distance
so let's say a thousand
pretty far away we're gonna be able to
detect our enemies let's go here press
tab
I think it's collating with something
else huh
okay sorry about that
um
yes I think it's colliding it should be
touching only the damageable
um and it has ignore itself so I don't
really know
why it's not detecting him there we go
now I don't know what happened but hey
now the camera is basically more up in
the sky so it's easier for us to go
ahead and see the enemy and so on and
it's easier to us for attack it will be
already pinned into the center of him
great so now we need to go ahead and
well do the opposite be able to unturn
your lock let's go here into the starter
we can get a branch
and
and sorry not a branch but we can just
get director here and then right click
and convert to valid again so basically
plug it here and if it's not valid it
means that this bamboo is empty we have
not a third lock to go ahead and unlock
hunt so we just want to do the
calculations but if we already have one
on we want to go ahead and get this
third lock and set it to be nothing
empty so now basically we will not be
able to continue to tire lock because in
Advantage it will detect that is empty
so if I try a lock as you can see I'm
sorry locking but when I press tab again
I will go ahead and be free and then I
can go and Target lock to him if it
takes I don't know why something's
detected or not but now we can go ahead
and try log again great so everything is
working and
um
I think it's colliding
with myself honestly
which is pretty strange anyway I'm gonna
also turn on the capsule component to
not be hidden in game because that's a
bit yes
um
and the swords should not have any
Collision but it's weird because
basically we have ignore self on so I
don't know why it's not sometimes not
detecting
see it's like
it's like making two different ones
strange but anyway
huh
oh you know what is the trace Channel
which is set to visibility let's go
quickly into here into our dummy
let's Ctrl e
and let's go into the capsule component
and basically if we open collection
presets you'll see okay visibility is
set to block
and the mesh itself
is set to block so it should always
detect it
so
okay now they type the person okay
anyway you can go ahead and right now
tire lock in our enemy also motion warp
into it okay so now there's only one
more thing left in this video and
basically it is the Dutch so again I
have left the animation in the
description is go ahead and load it from
Google Drive it's again from the RPG
template from epic games totally free I
just extracted this animation so it's
easy for you guys and it's good go ahead
and grab it and just drag it into the
content browser but first let's go ahead
and open the folder so everything is
organized let's go to characters RPG
character animations and now let's go
ahead and create a new folder it's going
to be Dodge and underscore Raw
let's go and open this and now we can
just drag it into here so the skeleton
will be the normal SK mannequin the ue51
and now we're going to say in Port all
and now we have the animation here so
you can see if we open it you can see
the motion warping happening and we need
to go under here and say enable root
motion and also force uh root block
great so now we need to go and create a
new input so we can play it so let's go
into the third person character input
and actions and just go ahead and right
click and create a new
reset input action EA underscore and
this will be basically this Dodge
we don't have to do anything we just
need to go into collection and I'll add
a new mapping in this case it will be
basically Dodge and let's say it's going
to be for example X
the thing is that we have control and
shift already for motion voting
and also crouching so we'll see later on
the series will arrange our keys better
of course and if we will also add a
mapping for controllers which is really
the best gaming is to play an RPG so I
will also add that and we better anyway
we can go back now into the third person
character
and let's go down over here entire lock
so again the a underscore is going to be
in this case
um
Dodge okay with the arrow and in started
we'll go ahead and say play a name
Montage okay great so now we have to
create an animation Montage so let's go
back into our animation that we have
just imported in here in the Dodge well
just right click into it create an image
we can leave the name like this go here
and just plug it in great so now we'll
play the animation each time that we
press the key
but we only want to do it uh basically
we want to do it even though we are
attacking so maybe I am attacking
and I want to go ahead you can see how
it look cool looks
um and basically
you know Vault so both no but Dodge okay
so uh the thing is that if not if I am
in middle of an attack you will see
and I vote not voice but Dodge you can
see that I cannot longer attack so
basically we need to detect if we are
attacking and if so can't sell the combo
so we need to go ahead and just get this
and make a branch and we're gonna go and
get our attack system component and then
say get is attacking
and if it's not attacking it will
directly go into the enemy Montage but
if it is attacking we need to get this
and do stop combo
and put it in true basically in between
great so that's pretty much it
so what we have to do
and
um
and that's it so now we can go ahead and
attack and I can dodge and then continue
to attack perfectly great
so now I can go ahead and tie a lock to
the enemy you can go ahead and start
fighting and then you can go and Dodge
cancel my attack move back here attack
Dodge in all directions go back here
Dodge and continue attacking great now
things like I can interrupt my Dutch and
looks pretty weird as you can see let's
quickly go ahead and make a variable
coach called not catch code and it's
dodging
and basically I need to change this code
to be instead of play and a montage play
animation
uh play Montage just play montage
hold Ctrl to get all the pins and mode
here and then let's plug in the Dodge
again so things like this node as
difference compared to the other one it
will have different outputs for when the
animation is completed also get the mesh
and drag it into this cartoon mesh so it
will play in that mesh out there so when
it's completed we'll get inside it's
touching to be false but when it started
we will set is touching two
through
and then as you start we will go ahead
and make sure that
um
make another branch
and make sure that we are not touching
so let's get touching and it's not
Boolean great so we cannot Dodge and
Dodge while we are dodging okay so now
you can see it's great I cannot do what
I was doing before great really good
stuff over here uh let's go into
characters would be character animations
go back into the Dodge row let's open
the Montage I just wanted to do the
final thing let's go into the blend out
and let's put this on cubic and let's
put around 0.4 seconds
basically it will just make the blending
out a bit smoother as you can see okay
this makes it a bit smoother
and uh there we go
so this one more thing that I want to
look is that sometimes you know it
doesn't it takes in the enemy for some
reason very strange reason
so I'm gonna go back into the entire
lock and instead of doing a sphere
trades by Channel I'm gonna make a
sphere
oh
and sphere trades for Optics it's pretty
pretty much the same thing but instead
of giving us Adventure detecting uh the
object by a channel it will just detect
the object by the object types let's
hold it uh code control move this down
hold Ctrl move this down hold Ctrl move
this down and hold Ctrl move this down
hold Ctrl move this down hold on
move this down if it doesn't crash while
okay well just plug the end point here
and the radius 125 and then the debug
type for duration let's go ahead and
just move it down because we don't need
it right now
let's put it up let's get object types
and say make array so now we can select
and in our case it will be pawns because
normally in Unreal Engine all the
characters are Pawns in our case it is
and it will continue to be so so pawns
and uh that's pretty much it so let's
see if that's gonna fix it hopefully and
it didn't it it made it worse basically
um
so maybe
Okay so
yes it's a pawn right
let's make it uh well maybe it's a
physics body because it changed
in a second guys
yes so it is a physics body if you can
try a pawn if it doesn't work physics
body and the reason is that we have it
so our mesh it has basically a physics
body in it that's really I mean the
capsule component is like a pawn kind of
but whatever reason uh but now it should
always work yes good good good
so now the combat should be way more
fluid as you can see
and and yes
okay
good
and also our crouching it is way
smoother
go here
there we go
cool cool sub over here so if you found
it so helpful I really appreciate you
could like the video and subscribe to my
channel I have lots of unviewings in
fact though so if you want to go ahead
and check them out go ahead join my
Discord server so you can go ahead and
you know show you the progress that
you're making in the series or in your
own games or price and also ask any
questions about the series or that you
have in general or not real engine on
top with other devs that just mean
follow me on my social so there's
Twitter and Instagram and now yes before
I said bye
foreign
[Music]
関連動画をさらに表示
Unreal Engine 5 RPG Tutorial Series - #9: Combat
Unreal Engine 5 RPG Tutorial Series - #4: Assassinations
Unreal Engine 5 RPG Tutorial Series - #2: Locomotion - Blendspace, Crouching and Procedural Leaning!
Unreal Engine 5 RPG Tutorial Series - #10: Sword Trace Damage and Hit Reactions
Unreal Engine 5 RPG Tutorial Series - #14: Equipment System
Unreal Engine 5 RPG Tutorial Series - #6: Damage and Stamina
5.0 / 5 (0 votes)