Transcripts
1. Promo: In this course, we're
going to create a game that we can fly a helicopter. We start from
creating a project. We will do the wheel setup. So the wheels of our
helicopter moves as well. We will have hand brakes
for those wheels as well. Next, we go for engine setup, how we can take off
this helicopter. And with that, we will have some visual effects like blade rotating and Naga visual effects for the dust beneath
the helicopter. We will have some sounds
with that as well, so it will sound more natural. In this helicopter, we can
go left. We can go right. We can go forward, backward. We can turn right
and left, as well. After that, we will implement a missile system so we can
shoot at whatever we want. And for doing that,
we need an enemy, so we can shoot at it. So for the enemy, we will
create anti air gun blueprint. So with that, we can hit our
helicopter and destroy it. This anti air gon can shoot at our helicopter if the
helicopter is in range, and it will rotate, so it will face the helicopter. For anti air gon, we will have visual effects. And sounds as well. And whenever some of these
bullets hit the helicopter, you will hear the sounds of its hitting the
helicopter as well. After that, we will have
some UI, for example, he, crosshair, and the amount of
missile that we can shoot. So without any further
ado, let's begin.
2. 01 Create project and import files: No for creating a
helicopter game. First, we need a game, and for doing that, I want
to use a blank project. I'm using Aria Engine 5.5 0.3. You can use the same
version as I'm using, but if you are using other
versions, you can do it. If you are a
beginner, it's better to stick with the
version that I'm using. So you don't see the
change in node's name. So no, let's just
create a blank project. Click on Blank. We want
it to be in blueprint. You don't need the
starter content, and the name of the project, I want to call it
hell or helicopter. I will call it hell. Where do I want to put it? I want to put it in
this folder, right. And that's it, head create and it will create the
project for us. No, with the project
open first and first, we need to save this level. So head control is to save it. I want to create a
new folder in here, and I want to call it levels, and I want to put it there. I will name it just New Map, head save, and it will
save the level there. No next thing that I
want to do I want to go to Edit editor preferences. And in here, I want
to search for open. So as a editor open location, I want it to be in
the main window. So whenever we open something, it will be opened over here. Next thing that you want to do, you want to go to edit project setting and go to
maps and modes and change the Editor starter
map to new map that we saved and game default
map to new map as well. Just with that, we'll be saved. No next thing that
you want to do. We want to go to Edit plugin. And in here, search for chaos. Go down until you reach
the chaos vehicle plugin. Just check that heads and
restart your project. Know that our project is
restart, what we need to do. In description of this video, there is a zip file that
is called Helly dot Zep. Just download that. Put
it on your desktop. You can open it if you
are in Windows ten or 11. But if you are not in
Windows ten or 11, you can download WinRAR
software for extracting this. Inside this folder,
you can see there is anti Argon and there
is a HeL folder. That inside each one of them, there is assets folder. These are all the asset that
you need for this project. Now, with that done, we
can just drag and drop it and put it on desktop
to be extracted. Now, you can see
it is extracting. With these two folder, we need to go to Areal Engine, go to Content drawer, click on Content folder, right, click on it, and
show it in Explorer. And it will open up the
Healy content folder, right? With that done, we need to drag these two folder anti Airgon and hell inside this content folder. That's all you need to do. Now, if you go to
Areal engine, in here, you can see there is two new
folder AntiaRgon and hell. We can just right click on it, set a color for them. For example, for the hell, I want to use green because
it is the player, right? And Antiirgon I want to again, right click on it,
set the color. This time, I want to use red because it is
the enemy, right? No, we have necessary asset to create our helicopter game.
3. 02 Create helli blueprint: Know that we have the
necessary assets, let's just create our first
blueprint for our helicopter. For doing that, first of all, if you go to inside
one of these folder, either one of them and you
don't see these assets folder, just close your Al engine and open it again and you
will see it there. Now, go to folder,
right clicking here, create a new folder in here, and we can call it blueprint. So all of our blueprints
will be here. Right click in here,
create blueprint class. And this time, go to
all classes in here and search for wheeled vehicle pawn, wheeled vehicle
Pan selected head select and we can
call it BP hell. Okay. That's it.
Let's just go inside. I'll click on it to open it. In here, we have a vehicle movement component
and we have a mesh, and this is a skeletal mesh. We can just click on it, and on its skeletal mesh acid, we can choose our helicopter and you can see it over here. That looks really awesome. No next thing that
you want to do. We want to add a spring
arm and the camera. So click on the mesh, click on AD and search for spring arm. Add
the spring arm. Next, click on the
spring arm and click on AD and add a camera. That's very important. No, next thing
that I want to do, I want to change the
length of or spring arm. Right now, you can
see it's too small. So click on the
spring arm and change the target arm length to 2000. Okay, if you want
to increase it, you can do it, but this
much is more than enough. No, you can see
the spring arm is a start at the bottom
of helicopter. What I want to do I want to
bring it up a little bit, just like this to 150 maybe at the middle of helicopter,
and that's it. Let's just head compile save. Now, let's see how
we can spawn it. For spawning it,
I want to create a new blueprint class in here, and I want to create it
off of the game mode base. I want to call it GM for
game mode, BP for blueprint. I want to call it hell. GM BP hell. Doll click on it to open it. And in here, the only
thing that you want to change is default punk last. You want to change it from
default pawn to BP hell. So this game mode will spawn over BP hell as
its punLss, right? Now, you can just
save it and close it. If you go to map, we can go to word setting. If you don't have
this word setting, go to Window and open up the word setting by
clicking in here. No, the game mode that you
want to overwrite is called GM BP hell game mode
blueprint hell, right? Just with that, if we head safe and run over game,
you can see, no, we can see our helicopter with the camera and the spring arm
that bring the camera back. Right. First problem
that you can see, you can see the wheels are not. Okay, let's see how we can fix.
4. 03 Wheel setup: No for fixing the wheels of a helicopter that
is not rotating. Okay. For doing that, there is a vehicle
movement component in here that we should tell it which of these bones
are your wheels, right? So let's just open up the
skeletal mesh of this. You can see there
is two at front in here and there
is one at back. Let's just go to content drawer. And in here, I want
to go to Acid, go to Vigilante content, go to vehicle, go to West Healy. And in here, open up
the skeleton, right? Skeleton of our helicopter. So now in here I
want to search for hell and you can see
we have one in here. I can hit F to Zoom on it. You can see this
is the first one. And after that, we
have real wheel joint. If we hit F, we will go there and we can test it
with rotating it, right? And we have art wheel Joint. And if you hit F,
we will go there, and we can rotate it
to see if it's okay. So we have three wheels Rtheljoint LF wheel joint
and rear wheel joint. We wanted to set
up these wheels. So go to BP Healy. In
here, we have three. So let's just create
three of them. Now, let's just expand
it to see what it needs. First, it needs a heel class. After that, it need
a bone name, right? So let's just choose the bone name first
for all the wheels, and after that, we
will go and create a heel class if it
is necessary, right? So go here, go to a
skeleton in here, and I want to do it
for left wheel joint, right click on it. Copy bone name. And we can just
paste it over here. That's it. We can go to the
next one for the next one. I want to do the right one
rtheljoint right click on it, copy bone name, and
paste it in here. No, I want to do the rear wheel. So again, let's just go here. We have rear wheel joint,
right click on it. Copy bones. And
paste it over here. And now for testing that, let's just go to or map so
I can eject from it, right? If I hit F eight and go in here, you can see the
front wheel is okay. It's not rotating.
Don't worry about it. We will fix that.
But the rear wheel, you can see it is in the sky, so that is a problem. So that's why we need to create wheel class for the
rear wheel, right? And I want to create a wheel class for the
front wheel as well. But first, let's just
create it for this one. Right now, the reason
that it is up in the sky, it's because the wheel
class is not good. The radius of the
wheel class that we are using in here by
default, it's not okay. It's not built for this. So let's see how we can
fix this problem in next
5. 04 Wheel radius: No, for fixing the problem, that the rear wheel
is in the sky. Let's see how we can fix that. For fixing that, I want
to go to content drawer, go to Hali folder,
go to Blueprint. And in here, right, click
create a Blueprint class, go to all classes and search
for chaos we go down. Chaos vehicle wheel. So we want to create
class for over wheels. So click Select,
and I want to call this one C ww for
chaos vehicle wheel, and I want to call
it rear wheel. Okay, rear wheel. Don't click on it to open it. And in here, you can see
we can change some stuff. For example, the wheel radius, that is much more important one. Just with this default value, if you go here and click on vehicle movement
component and go here and choose the CVWRar
wheel that we create together, let's see what will happen
if you compile and run no, you can see again it is in the sky that
doesn't work good. No, let's just go
here and change the wheel radius to
20, for example. And with that, if
you hit run again, you can see it's
close to the ground. No, let's just change it
to ten and test that out. If you run over a
game and eject, no, you can see it is on the ground and
that looks beautiful. The front wheel are okay, but I want to create a
class for them as well. So if we need to change them, we can change them, right? So go to Content drawer. I want to click on this
CVWRarwheel, Control D, to duplicate it, and
I want to rename it to front wheel, right? Front wheel. And I want to change the radius 10-30 maybe, right? Head compile, save, go to or BP, click on vehicle
movement component and change the wheel class for
the front wheels from chaos, vehicle wheel to front wheel
that we create together. So this one as
well, front wheel. No, let's just say settle. If we run over game and eject, no, let's just look at it. No, you can see
these ones are okay, and the ones are okay as well. Everything looks beautiful. Everything looks
natural, but the problem is hell is moving, but our wheels are
not rotating at all. So let's see how we
can rotate our wheels
6. 05 Wheel rotation: No, for rotating our wheels, whenever our helicopter is
moving, for doing that, we need to create
animation blueprint for helicopter skeletim. So right clicking
here, this time, I want to go to
Blueprint class to create the animation blueprint. I want to search for vehicle. And if you go down, you can see vehicle
animation instance because we are using a vehicle. The helicopter is
just a vehicle. So when we create animation
blueprint for a vehicle, we need to create vehicle
animation instance. So choose it head
select, and in here, I want to call it
ABP Halley, right? Dog, click on it to open it. I will tell you that
it doesn't have any skeletal mesh. Do
you want to set it? You say yes, and you choose
the skeletal mesh of O helicopter and you
hit Okay, that's it. No, let's just do,
click on it to open it. In here, first thing
that you want to do, we want to get the mesh f
pose or mesh space, if pose. This will give us
all the information about the bones
inside or skeletal. Now after this, we
need to search for wheel control for wheeled
vehicle with that. You don't need to do anything if you just connect
it to output post. With that, all the
wheels will work fine. And know that we create this, we need to set it
inside our BPHlly. Click on the skeletal mesh or helicopter and choose
the anim class for it. The animal class
for it is ABP hell. So let's just choose
that head compiled save, and now we can just
run over game. Now if we eject, you can see each
rotating perfectly fine. You can see each rotating fine. All of them are rotating fine. But the problem right
now you can see the radius of this
wheel is not good. It's a little bit
inside the ground. So we can just go to rear wheel, CVWRar wheels and change it to, for example, 15 again and head compile let's just
test that one more time. And let's just go
here, and that's it. That works fine. 15 is
the good number, right? This one is good, and the front one are good
and they are rotating. And our helicopter
looks awesome right.
7. 06 Look up Down: No next thing that
you want to do. We wanted to be
able to look around our helicopter with our mouse. Let's see how we can do that. For doing that, I want
to go to content drawer, and in here in Hell folder, I want to right click,
create a new folder, and I want to call it inputs. Okay? I'll click on it
to open it in here, right click, go to input. First thing that
we want to create in is a input mapping context, and I want to call
it IMC hell, right? And don't click
on it to open it. Next, we need to
create input action. I want to do first
look up and down. Right click in here, go to
input and create input action. I want to call it I
look up down, right? Dt click on it to open it. The value type, we want
it to be Axis one or a float because either we are looking up or we
are looking down. So Axis one D is
more than enough. You can just save
it and close it. No, we need to map it inside
or input mapping context. So click in here to
add a new mapping, and we want to map the
I look up and down. And in here with what we
want to look up and down, click in here, we
want to do it with mouse with mouse Y. That's it. No, we need to go to BP Healy in event graph in begin play. We need to add that
mapping context. We need to get the
player controller first, get player controller. And after that, we need to
get enhanced input off of it, enhancing input
component off of it, and add the mapping
context to it. Add mapping context, right? The mapping context
that you want to add is called AMC hell. No, with that done, we can go down in here and
search for IA L up and down, and it will give us
a event in here. But what we want to
change with this event? We want to change the pitch rotation around
the Y axis, right? So in here, whenever
it is triggered, we want to say add controller, pitch input because we want to change the pitch so we
can look up and down, right, with the
action value, right? Let's just see what will
happen just with this. If you run over
game, you can see, I can't go up and down, but definitely the controller
pitch is changing. What you want to change with the controller pitch is the
spring arm pitch, right? The spring arm pitch, we want it to change
like this, right? We wanted to change like this. So for doing that, we
need to click on or spring arm and tell it to
use pun control rotation. So if the control
look up or down, you look up and down
as well. So use that. Use the control rotation
for your own rotation. Now with that, if you compile, save and run no, you can see, I can
look up and down, but it is in inverse. If you wanted to leave
it as in inverse, you can do it, but I
don't want it like that. So for fixing that, I want to go into content drawer and open up
the I look up and down, and in here, add the modifier. Add modifier, the type, I want it to be negate. So with the negate, it will
inverse the inverse, right? So now, with that one, if you run over
game, you can see, I can look up and down
normally with over moose no, we want to do look
left and right. For looking left and right, we need to change the
rotation around what? Around the Z axis,
that is called ya. Just remember this stuff. This is really
important to remember. Rotation around the
Z axis is called ya, and rotation around the
Y axis is called pitch. Rotation around the X axis that is or forward Vctor is row. So no, it is a
challenge for you. Try to create the
input action, map it. So with the most X, we want to change the
rotation around the Z axis. So we want to change the controller so we can
look left and right. You try to do that.
We'll do it in next.
8. 07 Look left Right: No for looking left and right, like before, we
need input action. So go to Content drawer in
heal folder in input folder, right click in here and go to input and create
input action. I want to call it IA. Lo left, right. Dog click on it to open it. The value type, we want it
to be axis one d or float. No, we want to map it, so go to IMC hell and add a new mapping. This time we want to do the look left and right, expand this. We want to look left and
right with most, right? So that's it. And
now we can go to BPlli in Avant graph and
right click in here, search for A L left and right. This time we want to add controller Ya input as we
explained it in last video, rotation around the Z axis is called Ya for
looking left and right with the action value that is value between
minus one and one, right? So, let's just head
compile, save and run. Now, you can see, I can
look left and right. That looks awesome. But one
problem that we have in here, you can see by default, the our helicopter is moving. So what I want to do in here, I want to add a handbrake. So whenever we hit a space, this movement stop
and our wheels stop. Let's see what we
can do that next.
9. 08 Handbrake: Now let's see how we
can use a hand brake. We can have it inside
any vehicle, right? Helicopter is like that. Let's just go to content drawer, and for that, I want to
create a input action. So go to input and in here, create input action,
and I want to call it a hand break, right? You don't need to
open it at all. You need to just map it because we don't need to change
anything inside it. So go to IMC Healy
create a new mapping, and we want to map the I handbake and when do
you want to happen, just click in here, head space
to put a space bar there. So whenever we had a space, it should use hand break. Go to file, save everything. Now, let's just go to BP hell
and in here, right click. And search for I
hand break, right? So no, inside this event, we don't want to
use the trigger, we want to use the
start and complete. When this start happen, whenever we press space, this start will happen. And whenever we
release the space, this complete will happen. So with that, we want
to have a handbrake. For a handbrake, you need to get the vehicle
movement component, and inside that there
is a hand breaking. So search for hand brake, sit that handbrake in. Put whenever we
press the spacebar, we want to enable the
handbake which is copy and paste with
control C, control. And whenever we
release the space war, we want to release
the handbrake. But let's see if it is
happening just like this. If you run over game and go to O wheels Hetaspace,
nothing is happening. Why nothing is happening. It's because inside our
wheel, CVWFront wheel, for example, we want to till it to be affected by a handbrake. So just enable that head safe. We don't want to enable the
handbrake for rear wheel, so don't worry about this one. You don't need to enable it. Now, with that done,
if you run over game and hit the space, you can see it didn't stop, and it is stopped in the place. So that looks awesome. Our handbrake is working fine. If you run over game again
and you can see it's moving, if I hit the space, it will stop there. And we have suspension
as well. Pretty cool.
10. 09 Input action for moving up and moveing down: No, we want to actually move. Let's see how we can do that. For doing that first,
we need an input. So right clicking here, create a input action, and I want to call it IA, move up down, right? Don't click on it to
open it the value type, we want it to be Axis one
D. So you can just put it on Acess one D and you can just close it.
We don't need this. And now we want to map it
or IMC hell and in here, we want to choose move up and down and how we want
to move up and down. We want to do it with left
shift and lift control. So click in here, head shift, so it will be there. Again, click in here
to add another input, click in here after
that head control. So now we have left
shift and lift control. So whenever we hit left
shift on our keyboard, the IA move up and
down will give us one. But whenever we
hit lift control, we want the IA move up and down event to give us minus one. So we go down, right? So in here, by default, whenever we had left control, it will give us one as well. But we want to negate
it with a modifier, so it will give us minus one. So click in here, negate
it, know what will happen. Whenever we had left shift,
it will give us one. Whenever we had left control, it will give us minus one. Just with that, let's
just go to BPL. I want to have some space. Right, click in here,
search for IA, move and down. With that,
what I want to do, I want to set the trotle input that is inside or vehicle
movement component, right? No, let's just
connected like this. Let's just had compile to see if something
happened or not. First, let's just
wait, head left shift. You can see nothing
is happening. If I head control or shift,
nothing is happening. For you to see it better, I want to use a printer string to show the action
value like this. And if you run, no,
we want to go up. So hold left shift. You can see it will give us one, but it's not going up. If I had left control, it will give us minus one, but nothing is happening, right? So for fixing that,
what we need, we need to go to vehicle
movement component and set up the engine. I want to create another video just for set up in the engine. So whenever you want, you can go back to that
video and watch it again.
11. 10 Engine setup: No, let's see how we
can set up our engine, so our hell it can
go up and down. For doing that, click on
vehicle movement component. Go down in here until you
reach the trusser setup. Down, and you can see the
trusser setup, right? So click in here to add the
thruster, we need just one. First thing, the truss type, because the engine is
not moving at all, so we put it on fixed. No for the bone name. Let's just go to a
skeleton or a helicopter. The bone that I want to use, let's go down is cog joint that is at the middle
of our helicopter, and it has all the
bones inside it. So that's why I want
to right click on it, copy bone names and put it for the name of over bone name. So what this means? It means whenever we head shift, this etrotal input will add some force to that bone in a direction that
we want, right? So we are just telling it to where this force should
be added to, right? The trust axis to
where it should go, I want to put it on Z one. This is X Y Z. The X and Y, we
want it to be zero, but the Z, we want it to be one. So whenever we head shift, the throttle will increase, and we want to
increase it toward the positive Z, so
we go up, right? So let's just go down again. Next, I want to change the
Max Trust force to 25,000. Of course, you can change this value whenever you
want, play with it, right? Just with that, if you
had compile and run, hold shift, no, you can see, it's going up with that. If we hold control,
it should go down. You can see. No, it's
going down. And that's it. We are on the ground
and we can hit the space to stop. You can see. That's really cool. But that is not all we want. I want to add the
torque control as well. So enable the torque control, and I want to change
the pitch torque scale into one and roll
torque scale into one. So whenever we want
to roll, we can roll. And after that, the
rotation damping, because I don't want
it to rotate a lot, I will put one in there as well. Next one for estabilizing
or helicopter, I want to enable the
establise control, and I want to increase the
altitude hold Z to 15. And these position holdings and why I want to
decrease it to one. This will help us to sublice our helicopter so it
won't move freely. Of course, we should
play with all of these values until we reach
the result that you want. Maybe you want the arcade game. You need to change this value. Maybe you want a
simulation game. Again, you need to change these values a lot,
and that's it. Or engine setup is good. Now, let's just test
that one more time. If you hold shift,
you can see how beautiful it's going and no, it has more es stabilization. If you go down,
you can see it is more establised and right now, we can't go left and right. But we did add some stuff in
here for changing the pitch, for going forward, and
going backward and changing the row for going
right and going left.
12. 11 Modify Rotor bone: We are going up and down, but the problem is it
doesn't look good. The blades are not rotating. The rotor is not
rotating, right? First, let me show you
what is the blade. If we go here, you can see this, we call it blade or rotor. So whenever the engine
start and they go up, these rotors, these blades
should be rotating. And for doing that, we need
to go to Animation Blueprint. In Animation Blueprint,
let me make some space. The node that you want to
use is called modify Bone. So search for Modify Bone. And in here, the bone
that we want to change. How we can find that. If you go to a skeleton, and in here, search for rotor. You can see there is lots
of them rotor, main joint. And if you rotate this
around the Z axis, you can see, that's what we
want to rotate. You can see. That's cool. Now, we note the bone rotor main joint.
So let's just use it. In this note, we need to
choose that bone rotor, rotor, main joint, right? We don't need to change
the translation, so we can go to detail panel and tell it to not
expose it as a pin. We don't need to
change the scale, so don't expose this as a pin, but we want to
change the rotation. And the rotation mode, we wanted to add to existence because if it have a
rotation from before, it should add to it, right? The rotation space, I want
it to be bonus space, so it will rotate
correctly, right? Because where
helicopter can roll, can change the pitch and
can do lots of things. So if you put it in bonus space, it will rotate according
to its parent, right? No about the rotation. Right click on it,
split the stroke pin. We need to change the
rotation around the Z axis. For example, if I put 45
in here and head compile, you can see it is 45, no, right? I don't want to do it like
this, what I want to do. I want to dragon up and
promote this to a variable. And I want to call this
rotor value, right? This is the rotor
value. Head compile. No, let's just change
the rotor value in any preview editor in here so you can see it's
rotating correctly. That looks really
beautiful, right? But how we want to do it, we want to do it
inside our blueprint. And from the start, we want to start slowly first because the engine
start slowly, right? After 1 second, it should reach
the maximum speed, right? So at the start, we wanted to rotate slowly, smoothly, and after 1 second, we wanted to go
to the max speed. And for doing that, we
need to use this value. But for calculating this
value what it should be, I want to use W
blueprint or BP hell. And let's see how
we can do that next
13. 12 Rotor rotation: No, we have a very well inside or animation
blueprint that with that, we can rotate over blade. But let's see how
we can rotate it inside blueprint blueprint
helicopter, right? So for doing that, I
want to use eventiqu, but I don't want to make
this eventiqu a mess. So that's why I want to
create a custom event. So in here, I will search
for at Custom event, and I want to call
it engine Manager. Right? We will do lots of stuff, but I will call it
engine manager. And I want to call this custom event in our
eventquEecution path. So whatever we connect to
that custom event in here, it's like connecting
it to eventiqu, right? So now in here, we want to have a variable. So with that, we rotate
the blades, right. The variable that
I want to create, I want to call it
rotor speed, okay? And this rotora speed, I want to increase
it every time. So this is not the
end way to do it. I will change it later. But for now, let's
just look at it. For example, each time I want to add five to it,
right, each frame. And with this value, we want to set the otoraped
with it, right, like this. And know that we have this
rotor speed, what will happen. Each frame, these rotor speed will be increased by
five unit, right? And with that done, let's just go to our animation
blueprint in event graph. And in here, first thing
that we want to do, we want to create a
event begin place. So with it, we get the BPL so we can access to
the variables inside it. So we need event
begin playing here, and we want to cast the owning actor of this
animation blueprint. Two BP Healy, right? And after that, we want to
promote these two variable, and I want to call it BP Healy. That's more than enough. Now, in the update
event in here, we want to get our BP Healy. We want to check if it is valid. So search for is valid. If it is valid, we want to get rotor speed, rotor, speed and set it
as rotor value, right? Set it with the rotor
speed, right? That's it. No, the rotor speed value at each frame will be saved
inside the rotor value. And because we connect
the rotor value to this modified bone, it should rotate, right? Now, if you run over game, you can see it always
rotating, right? That's not good. We want to know if the engine is on or not, if it is started or not, if it is shut down or not. I for the first time we head shift or control
on our keyboard, we want to slowly
rotate this, right? And after 1 second, we want it to reach
the maximum speed. So this way of doing
it is not good enough. So that's why we need to know
when the engine started, when the engine is
shut down, as well. So let's see how we can
do that next video.
14. 13 Engine manager: No, we are rotating the blades, but the problem is, it's
always rotating, right? Let's see how we can fix it. You can see in here,
it's always rotating. It doesn't matter if
you are on the ground, if you are going up or
if you are going down. Nothing is changing, right? The speed is not changing. For fixing that, we need to know about the
engine state if it is started before or if it is just starting or
if it is shut down. And for doing that, I want
to create some variable. So first variable that
we want to create is called engine start, right? And the next variable
that we want to create is called engine started, right? And the next variable
that we want to create is engine shut down, right? Know with these variables, what I want to do in here, whenever we head shift
or control or keyboard, we want to check if the engine started
from before or not. So get the engine
started, and in here, I want to use a
branch like this, connect the execution pino it. If the engine
started from before, just do everything normally. Just set the throttle input with the action value
like before, right? But if the engine
was not started, no, we want to start it, right? So for starting
the engine, first, we need to set the
engine a starting here, set the engine start. If the engine was not
started and set the engine shut down to false
because we did start it, so engine shut down
should be false. And after some
delay, for example, 1 second, we want to
say engine is started. So after 1 second, we want to say engine
started is True, right? True. That's it. Let's
just connect it like this. After that, you can change
the throttle, right? That's all we need to do.
Let's just head compile, save. Nothing happened because we are just changing some variables. But no, with those variables, I want to check on this engine manager that is connected to Eventiq if this engine
start, get to be true. We can check it with the branch. If it did get to be true, in that case, you can
rotate the blades, right? Let's just head compile, save and run over game. You can see by default, it's not rotating, but
if we had shift, no, you can the blades are rotating, and that looks awesome, right? No, the blade has
a constant speed. We don't want it
to be like that. We want to slowly
change the speed. Let's just do it in next video.
15. 14 Diffrent Rotor Speed: Our blades will rotate whenever we had shift or
control on our keyboard, right? It won't rotate
by itself, right? That's good a step in
the right direction. But when we head shift, we want to slowly change
this rotor speed, and after 1 second, we want to reach the
maximum speed, right? So for doing that, in here, we want to change these five. So at the beginning,
the rotator speed, every frame will increase
by five every frame, right? We want to be able to change
these five by some value. First way to do it, we can check this engine
started, right? So in here, we can
check with the branch. Of course, this is
not the way that I want to do it at the end. So don't do it. Watch, right? So if the engine was started, we want to increase this
value to 25, for example. But if the engine
was not started, this falls will happen, and I want to
control C control V to paste everything down here. In case of falls, we want it to increase by five. Now, let's see what will happen. Compile, save and run over game. And knowing here,
if I hold shift, you can see at the beginning, it is lower speed, and all of a sudden when the engine started
after 1 second, it will increase
to 25 each frame. Each frame 25 will be
added to the rotation. You can see how it looks like. Again, let's just look at it. At the beginning, the
speed is less can see. And after 1 second,
it will be increased. And that's with this
delay that we have in here between engine start
and engine started, right? Engine start and
engine started, right? But I don't want to do
it with the branch. It doesn't look good, right? So what I want to do, I want to do it
with interpreter. This note will smoothly
interpret this value from, for example, zero
to 25, for example. But for doing it, I want to create another video
just for that. So let's see how we
can do that next video
16. 15 Finterp to: No, you know what we want to do. We want to change
the rotation speed based on if the engine just
started or it was started. Know what we want to do. We want to smoothly change
the rotation speed, rotary speed when the
engine start, right? So for doing that, we
need to change these 25 that we have in here that every frame we add
to rotary speed smoothly to 25. So at beginning when the engine
start, it should be zero. And after 1 second, we want to smoothly
change this to 25, right? So for doing that,
we need a variable. In here, I want to right
click promoted to variable, and I want to call it
rotor speed rate. Okay? So in here, we can just put
whatever value that we want. But what we want it to happen, we want to smoothly change this rotor speed rate to the maximum speed
that is over 25. So at default, we
want it to be zero. No, with that done, if we hit run in here, you can see if I hold
shift, nothing is changing. Can see nothing is changing because this rotor
speed is zero, and it will add zero to rotary speed every
frame. Nothing happened. So what do you want to
do? We want to change this rotor speed rate when the engine start smoothly to 25. And we can do that with the node that is
called interp two. And because we want to
change a float value 0-25, we need to use F interpret that is over here,
F interpreter. This node needs a current value. The current value
that you want to change is zero, that at default, it is zero, and it is
our rotary speed rate. We want to change this
rotary speed rate to target value that is 25. And this node needs delta time. We can get the word Delta second for that, and after that, the interpepeed. For the interpose speed, I want to put it on 0.5, but we should play
with that value. So what this node will
give us on each frame, this F interpreter will check
the rotor speed rate value and change it toward the target value slowly based on this interpos
speed, right? And every frame, we need
to save this value that this effin turf gives us inside rotor speed rate as
well, like this, right? So connect the execution
pin to it like this and connect this return
value to rotor speed rate. Now, let's just see
what will happen. If you run over game, you can see by default
it is off shut down. If you hold shift, you can see it will
slowly increase the rotor speed until it
reached the maximum speed. No, you see how
beautiful it looks. Again, let's just look at it
at default, nothing happen. If you hold shift, see, it will slowly change the rotary speed until it reached 25 each
frame, and that's it. That's how we can slowly, and smoothly change the rotary
speed to a maximum value.
17. 16 Hovering: No one additional things
that we want to add to our helicopter is the ability
to be hovering, right? Whenever we release shifts, when we are going up, we want hover at that height. And whenever we hold control and we are going down and
release the control, we want to hover at that height. So let's see how we can add hour ability to our helicopter. So for doing that, whenever we release shift or control
on our keyboard, we need to save the height
that we were in, right? So for doing that, I can
just get the actor location. And with that on a
split asteroid pin, this Z value is the height
of our helicopter, right? So if we save it, when we release shift
control on our keyword, what it will happen, it will save the height
at that moment, right? So we can promote these to
a variable, the Z of it, and I can call it height
to stay on, right? And if we save it when we release shift or control
on our keyboard, it will save that height
inside our variable, right? Now, with that, we know that there is a height that
we should maintain, that we should hover
on that height, right? So now, let's see how
we can hover there. For Hering, I want to
change this throttle input up and down so we
stay on that height. And how we can do that, I want to do it in here. In this engine manager event that is connected to eventiq. At the end of it, first, I want to check with a branch to see if there
is any input or not. So in here, I can get
the I move up and down. So with this, I will get
the action value in here, the action value that this IA
move up and don't gives us. If it is equal to zero, if it is equal to zero, it means there is no input. So if there is no input, we can maintain this height that we save that inside
this variable, right? So, no, in case of true, we want to change the throttle input to
either go up or down, so we maintain that height. Control set copy this
and paste it over here. But what value we
want to put in here? If we put one in here, it will go up and if we put minus one on this
throttle, it will go down. How we can manage this, how we can change this throttle, so it will stay at the
height that we want. For doing that, we want to
check the current height of our helicopter and the
height that it should stay on. So for getting the current
height of our helicopter, we can get the actor location
again, get actor location. And with this, if we right
on it to split rock pin this Z will be the
current height of our helicopter, right? I want to subtract
this with the height to stay on like this to see
what is the difference. If the current height is bigger than the height
that we should stay on, so we need to decrease
the throttle, so the helicopter
goes down, right? But if the helicopter
is down here and height to stay on is up here, it means we should
increase the throttle, so the helicopter goes up to that height
to stay on, right? Now with this substraction, we have difference
between the height. With that value, I
want to use a node that is called map
range clamped, right? So we check the difference
between the height that we currently have with the height that should stay on. If it is between zero and -15, we want to change the throttle
with a value 0-0 0.7. That's it. I need execution
pin. Let's just give it that. Let me explain it one more time. Let's say our helicopter is up here and the height to
stay on is in here. Height of our helicopter minus the height that
we should stay on, it will give us a
positive value. For example, ten, for example. Ten in here is not
between A and B in range. It won't be between these two, so it will clamp it to zero
because it's closer to zero. At the output, it will give
us the throttle of zero. So in that case, the gravity will bring down the helicopter to that
height to stay on. But in other cases, if the height of our
helicopter was less than the height that we should
stay on, what will happen? Height of helicopter minus the height that we
should stay on, it will give us a
negative value. For example, minus ten. So minus ten is a value between this in range
A and B, right? So this map range clamp will
give us a value 0-0 0.7. For example, 0.5 and
0.5 for throttle, it means the helicopter
will slowly go up until it reached the
height to stay on, right? But let's say the height
to a stay on with the current height
of our helicopter is the same. What will happen? Height of over helicopter minus by height to stay on,
will give us zero. So if the range was zero, it will give us zero, and there won't be any throttle. Just with that, let's just
compile save a runw game. If we go up, if we go up like this and
release the shift key, you can see it a
little bit go up, and after that, it will
stay at place, you can see. The height of a
helicopter right now, it's not changing at
all. It will hover. It is going back because of the rotation of our
helicopter because right now, we can't change the pitch, so we can go forward
and backward. But you can see the height
of it is not changing. Again, if we go up and
release the shift key, again, it will
maintain that height. And if we go down, again, it will maintain that height. That's really cool. No, with this, we have the functionality of
hovering over helicopter.
18. 17 Check height with line trace: No, I want to add more
effects to helicopter. For example, the dust
when the engine start, we want to have some dust
beneath over helicopter. Let's see how we can do that. For doing that, I want to go
here at a Niagara effect, okay, Niagara particle system. I want to call it
dust fix, right? And with this the Nagar
system that I want to put in there is called NS hell ground dust.
Let's just put it there. Go to our view port,
and in here, right now, you can see nothing is
happening because there is a user prompter that
is called proper speed, that if we increase that, you can see, there will
be some dust there. If we run over game
with that value, you can see, there
is a dust there. So based on the distance to the ground that we have
and the rotor speed, we can decide what the
proper speed should be. For example, if we
want it to be 100 or if we want it to be
500 or whatever, right, how much
we want it to be. By default, we want it to
be zero because by default, the engine is not started. So let's see how we can do that. For doing that, first of all, we need to know what
is the distance between our helicopter
and the ground. Right? So for doing that, each frame I want to do that. So I don't want to again
mess up this eventiqu. So that's why I will create
another custom event, and I want to call this one. Let's just create custom event. I want to call it
dust manager, right? And after that, let's just
connected to the eventiqu and I want to call it dust
manager, right? That's it. Let's just go here.
First of all, let's see how we can measure the distance between our
helicopter and the ground. For doing that, I want
to use a note that is called line trace
by channel, right? This line trace by channel needs a start location
and end location. If it hits something, there will be a bully
and at the end of it, that it will tell us that you
did hit something, right? So for the start location, I wanted to start at the
middle of our helicopter. So let's see. How we can get the middle of
our helicopter. The helicopter 00 location
is at the bottom of it. That's not what I want. What I want is the middle
of our helicopter. And if you remember, we put the spring arm at the middle of our
helicopter. That's good. Now, for the start location, let's just use this
spring arm location. So for doing that, we
can get spring arm and get the word location
off of it, right? This is start point. And from this start point, we want to check if we draw a line from that middle
of our helicopter down. If we hit the ground, what is the distance between the helicopter and
the ground, right? So for the end location, I want to minus this by a
big value in Z direction. It should be just
in Z direction, so we check the direction
to bottom down, right? So I will put 50,000, for example, in here, a really big value
for the end location. For you to see it better, I want to go to the
row Debug type and tell it to show
it for one frame. Now, let's see what will
happen if we compile and run. Now, you can see there is
a line at the start at the middle of where
helicopter to the ground. If we go up because there is
a square at the end of it, you can see it is
hitting the ground. If we go up, if we go up enough, you will see that
square will go away because we are reaching
more distance, right? The last distance
will be 50,000. Of course, it takes too
much time to reach this. But no, based on the result that this
line trace gives us, we want to decide what the proper speed of the
dust VFX should be. And if we drag and drop from this out heat and
break the result, this will give us
the distance between the start location
at the middle of our helicopter to where
it hit the ground. It will give us that distance. Let's see how we can use this distance to
change the proper
19. 18 Dust VFX location: No, based on this
distance and rotor speed, we wanted to change
the proper speed of our no graphic that dust effect
underneath our helicopter. But first problem
that we have in here is the location of our Nagraphc. For seeing that, let's just
click on dust Vafix and change this proper speed to 250 so you can see
it better, right? If you run over game, you can see if I go up, you can see the affix is again at the bottom
of our helicopter. So first thing that
we need to do, we need to put it on
the ground always. And how we can do that, we can do it with this impact point where these line trace hit
the ground, right? So we need to use a
branch in here to check. If it hits something, put the nagareffect
there, right? So let's just get the dust
affix in here with it, we want to set the word
location on it, right? And the location that we want to use is this location
that it hit the ground. That's it. Let's
just compile, save. Right now, you can see there
are some dust in there. If you hover, you can see
it is on the ground always. That's what we
want it to happen. Always, the dust should
be on the ground. So that's working fine. That one problem is fixed. Now, we want to check
some more stuff. We want to change the
proper speed based on the rotor speed and the
distance to the ground. Let's see how we
can do that next.
20. 19 Dust prop speed: Know, based on the distance
to the ground that hell has. And with the rotary speed, we want to decide
what is proper speed, how many dust or a helicopter
should create, right? So for doing that,
we need to set a parameter or dust Vax that
is called proper speed. First of all, let's
see how we can set that parameter in blueprint. Make some space. I want to do it at beginning of
this dust manager. When you get to dust VFX and
set a float parameter on it. The set float prometer, that is child up
particle system, right? Just with that, let me connect the execution pin to
it to here as well. Now, this dust VFX
has a parameter inside it that is called
prop speed, right? That with it, based on
the rotor speed rate, not the rotary speed because rotor speed is increasing
to a really big value, so it will rotate the blade. But the rotor speed rate, it is a value 0-25. At the maximum
value is 25, right? So, based on the rotor speed, multiply by distance to ground
factor of our helicopter, we want to set this
proper speed, right? So for distance to ground, we can't just connect the distance to here
because you see, we have a distance on this
othead result, right? But we can't use this distance. Hope, we want to use it. I want to create a variable, and I want to call it height. Factor, right? Height factor. So with the height factor, multiply by a rotary speed rate, we want to decide
the proper speed. Let me clear it, right? So if the rotary
speed rate is zero, it means the blade is not
rotating at all, right? So there shouldn't
be any dust, right? So zero multiply by height factor doesn't matter
what is the height factor. It will give us zero
for proper speed, and there will be no dust. But let's say the
rotary speed is 25. After 1 second, the engine started and the rotary
speed rate is 25. 25 will be multiplied
by height factor, but what is the height factor? We want the height
factor to be like this. If the helicopter is
underground, the height factor, we want it to be at
a maximum value, so it will create lots of dust because it is
close to ground. But if the helicopter is
really high in the sky. We want this height factor to be zero because it
is really high, it shouldn't create
any dust, right? So this height factor will
be in inverse with distance. If the distance increase, the height factor will decrease. But if the distance to
the ground will decrease, the height factor we want it to be increased, and
how we can do that. We can do it with
this distance, right? But before doing that, if this line trace
doesn't hit anything, this falls will happen. It means we are really high. So we need to set this
height factor to zero. That's it. That's really
important, right? Next, we want to
check the distance, and I want to use
map range clamp. I want to say, if the
distance was 0-3 thousand, give us a value 100-0. So what it means? It means if the distance to
the ground was zero, it means we are on
the ground, right? So give us 100, right? But if the distance to
the ground was 1,500, for example, it will give us 50 on this return value, right? And if the distance
to the ground was 3,000 or more than 3,000,
it will give us zero. Zero multiplied by rotary
speed at the beginning. It will be zero, and there will be no
dust, right? That's it. We want to set
this height factor with this value like this, and that's all we need to do. Let's just head compile and run. And now you can see
there is no dust because the rotor speed rate is zero and the blade
is not rotating. But if we rotate,
just look at it, there is lots of dust because
we are on the ground, and the rotor speed is at
the maximum as 25, right? Now, if you increase the
height, let's just go up, no you can see the amount of dust that it is creating
is less and less and less. You can see how much it is. Now that we reach
more than 3,000, you can see there is
no dust on the ground. But if we get close to the ground again,
there will be dust. You can see if we
go to the ground, you can see, there will be dust. One problem that I seen here, you can see the rotation of
visual effxs is not okay. That's why some of them is
going under the ground. Let's see how we can
fix that really fast. In here, you remember we set
the word location of dust, affix. What do you want to do? We want to set the word location and rotation of dust, right? So let me connect it like this, connect it like this and
delete this one, right? For the location, as you know, we can just use this
location connected to here. But for the rotation, I want
to use this location and use rot from s to get a rotation
of our impact location, the location that we
hit the ground, right? That's it. That's
all we need to do. Now, let's just had
compile and run. Now, you can see if we go up. You can see the rotation
of our dust is okay, and all of the dusts
are underground. Now, if you increase, you
can see the dusts are okay, and if you increase the
height you can see it is having the less dust and
less until it reaches zero. If we go down, you can
see, there will be dust. And if you reach the ground, there will be more dust when we decrease the height
of our helicopter. Now, you can see
how cool it looks. That's really beautiful.
21. 20 Engine meta sound: No, about the engine sound. Right now, we have
the rotating blade. We have the dust fix, but we don't have
the engine sound. Let's see how we can do that. For doing that, I want to go
to Contender InhaliFolder. I want to right click, create a new folder and I
want to call it sound. Right double click on it, open it, right click in here. Go to Audio and create
a metasund source. I want to call it s
All engine, right? Doll click on it to open it. And in here, I want to
create a wave player, right? First wave player that on
play, we wanted to play it. But what we want to play, we want to play the
helicopter hovering, right? That's it. Just choose it there. We want it to be on loop and connect the
Otmano to Otmano. Now, if you play
it, can see this is just a helicopter engine sun, right? That looks awesome. But first thing first, when the engine is not started, this shouldn't have
any volume, right? That is the first thing
that we want to do, and we want to smoothly
change the volume and change the pitch when the engine
start turning on, right? So for doing that, what I want to do I want to create another one of
these wave player, exactly the same thing
with the same wave act, but I want it to
happen after 1 second. So whenever we play this MS hell engine,
what we want to happen? First, this one we
want it to happen, but after 1 second, we can do it with
trigger, delay. After 1 second, this one we
want it to happen, right? And how we can have
both of these together, we can use a mixer in here, mixer mono two, right? In the in zero, we want
it to be this one. In in one, I want
it to be this one, and we want to mix both
of these to output. Know what will happen. If we play this, first, this will happen. You can see it and
after 1 second, this will add to it,
right, stop this. Next thing that I want to do, I wanted to be able to change the pitch and the gain
or volume, right? So we need some input. So in here, I will create input. I will call it volume. Right? And drag and drop
it. Put it over here. We wanted to be able to change
the volume just like this. And next we want
it to another one. I want to call it pitch
and drag and drop it and connect it to pitch
off both of them, right? Now, with that done, let's just play to
see what will happen. Nothing is happening
because the volume is zero. If you increase
the volume to one, you can see, No, it's more sound like a helicopter starting
it in its engine. Let's just look at
it one more time. S. After that, you only
change the pitch as built. Jesse, it sounds more
like engine starting. And the range of this pitch, I want it to be 1-5. And let's just stop
it and run again. If I increase the volume to
one and change the pitch, you see, we changing the pitch. What will happen, it's like the blade is moving much faster. So now with that, we have a metason that we can
use it for the engine of our helicopter when it's
start and when it reached the maximum speed with this
volume and this pitch shift.
22. 21 Engine sound: Now we have a metasund that we can use it for the engine
of our helicopter. So let's see where do
we want to use it? For using it, let's just
add a audio, right? It should be a
child of the mesh, and know in here, we want
to choose our metasund. It is called MS Lngine. Just put it there.
Now with that done. On this engine manager, we want to manage the engine
sound as well, right? So let me create some space after the engine
start in here, right? So make a little bit of space. What you want to do we want
to first change this name. I wanted to name
it engine audio, and I will drag and drop it, put it over here, and
set a float prometer. You can see there is
two of them in here. The one that says target is audio component is the
one that you want to use. So select that. First thing that you want
to change is called volume. So put volume there. And we want to change the volume based on the rotor speed rate. That is a value 0-25, right? And how we want to
change this volume, I want to use a map range. I did use this node a lot
in this course, right? So the in range is 0-25, but the out range, I want it to be 0-2, right? I don't want it to
be more than two. So if the rotor speed rate
at the beginning is zero, it will give us zero
for the volume. But if the rotor speed rate
was 25 at maximum speed. The o range will be two
and volume will be two. It's not just the volume. We want to set another prometer. So let's just copy and paste
this over here as well, and connect the
execution pin to it. Connect the execution
pin to this one as well. Make some space in here. And now we want to change
the pitch as well. So put the pitch name there. No, again, I want to use this map range clamp.
No, we know that. Again, the rotor
speed rate is 0-25, but the range, the pitch value based on this rotary speed
rate on it to be 0-5. Just with that, make
sure in your meta sound, all the default value are
zero, just like this. Make sure you save everything. And no, if we run over game, you can see there is no sound, but if we hold cheat, just listen to it. You can see how beautiful
it looks, right? Engine s now is
there and more good. We have engine some that with the speed of the blade is changing its
volume and its pitch. Let's just look at it one
more time. Hold shift. You see, the pitch is
increasing as well. And I think that looks. That sounds awesome.
23. 22 check if we are on the ground: No next thing that
we want to do. We wanted to be able to
shut down the engine. Let's see how we can
do that in this video. For doing that, first, we need a input. Let's just go to Input folder, right click in here and
create the input action. I want to call it IA. Shut down engine, right? You don't need to
change anything in it. We need to just map
it in IMC hell. So in here, add the mapping, go down and map the IA
shutdown engine, right? And in here, how we want
to shut down the engine, I want to use O on or keyboard. So click in here, head O on your keyboard
and head save. Now we can go to BP hell and
in here, what I want to do, I want to get the IA
shut down engine event. Whenever we press this, let's just use a printer string. I want to say shut
down engine, right? And let's see if
it's working or not. If I go up and go down again Oh, see, it will say
shut down engine. So event is working fine. But how we want to
shut down engine. First, we need to check if you are underground or
not, how we can do it. I want to do it with a variable. I want to call it
on ground, right? And the type of it, I want it to be bullian
and by default, I want it to be true
because by default, we are underground, right? No where do we want
to change that? If you remember, we
have a line trace from the middle of or
hell to down, right? In this case, when the
line trace hit the ground, this true will happen. Let me make some
space over here. And here, we want to
chap the distance. If it is nearly equal to zero, it means we are erground, right? So if the distance from
the middle of helicopter, to the ground was
nearly equal to zero, it means we are underground, and we can set the
ground variable, set it with this value
over here, right? So if the distance was
zero, this will be true. But if the distance was not
zero, this will be false. But there is an error tolerance. Why I did use nearly
equal because we are measuring from the middle
of where helicopter. So that's why I want
to add some tolerance. For example, ten, ten
centimeter, right? So if it is equal to
zero or nearly equals to zero by some tolerance
of positive or minus ten, we can say we are underground. For you to see it better, I want to go to event tk and show it with
the printestring. So in here, you'll use
a print test ring with a key add the kio it
will be persistence. For example, whatever you
want, you can put in there. And in here, I want to show the ground variable. That's it. Now if you run over game, you can see it
always saying false, why it's saying false. The reason that it
always say false, if you go down here, the tolerance is ten. But where a helicopter,
as you can see, the litres from the middle to the ground is more than ten. Let's see what is that, for you to see it
what I want to do, I want to use a printer
ring in here as well, and show the distance, right? Show the distance over here, and I want to disconnect this
one for no and Runo game. When we are on the ground, the torans you can
see it's like 140. So we need to put 140 there or a little bit
more than that value. Let's just connect this again. Organize a little bit. No, this tolerance value, we wanted to put
it on 150, right? No, with that done, we don't need this printer ring, so let's just delete that and
connect this to the branch. No, you can see it says true. If we go into the
spy, it says false, and then we go back. Sa, right? So with this, we know where we are erground and where
we are in the sky. And we want to use this to decide when we can
shut down the engine. So let's just go to
our event in here. Whenever we head or keyword, we want to use a branch in here. And I want to say, if we are underground, let's just use a
printer ring in here to say shut down engine. And if it is false, again, use another prints ing. I want to say can't
shut down engine because we are not on
the ground, right? That's it. And I want to make this red so you
can see it better. If we hit run and in here, it 01 or keyboard, it can shut down the engine. But if you're on the sky
and Oh, you can see. I will say can't shut
down the engine. You see, doesn't matter
how much you there. I won't be able to
shut down the engine, but if you are on the ground, Oh, it says, You can't
shut down the engine. No, we are showing it
with the prints ring. And next video, we want to
actually shut down the engine.
24. 23 Engine shutdown: No for actually shutting
down the engine. We check if you are
underground or not. So with that, let's just
see how we can do it. In here, if we are underground and we head on or keyboard, we want to shut down the
engine, and how we can do it, we can change this
engine, shut down, set it to true, and set the engine
started to false. That's it. With that, we know when to shut
down the engine. So let's see how we can
use these two variable. You remember in here, we change the rotary
speed rate 0-25. Now, if the engine shut down, we want to change the
rotary speed from whatever value it has to zero exactly like
we did it in here. So I need to make some space. This part is for hovering, so we can select it Hetson or keyboard and
put hovering there. So we have some note
there, comment there. No, I want to create
some space in here. Before changing the
rotor speed rate to 25, we want to check with a branch. Like this, we want to check if engine is shut down or not. If the engine is shut down, this true will happen. But if the engine
is not shut down, it means it is started. So we should connect it to
the false, right, like this. If the engine is shut down, we want to do all
of this up here. So Control C control
to paste it up here. If the engine is shut down, we want to change
the rotor speed rate smoothly to what zero.
That's all we need to do. And after that, we can go and check the Haring,
as well, right? That's it. Let's just
head compile, save, and run over again to see if
it's working fine or not. If it started orgs after that go down and we on your keyboard, no, you can see the
engine is shutting down. You can see how
beautiful it looks, and the dust will go away as well when the rotary
beat goes to zero, and you can see it.
Good no, right? We can go up. The
thing is working fine can shut down
the helicopter. But if you are on
this side and we try to shut down the
helicopter, we can't do it. But if you are on the ground
and it on your keyboard, no, you can see the
engine will stop. That's it. We are shutting
down the engine correctly. And the sound is working fine, and the blade rotation speed
is working fine as well with
25. 24 Go forward and backward: No, for going forward and
backward from now on, I think everything will be
much easier and more fun. For going forward and backward, we want to use WS
key on our keyboard. So with that, we
change the pitch. So we go forward like this and we go backward
like this, right? So let's see how we can do that. For doing that, we need
to create input action. So right click in Input folder and go to Input
create input action, and I want to call it IA. Move forward, backward, right? Don't click on it to open it. The value type, you want it
to be Axis one dy or float. That's more than enough.
You can just close it. Go to IMC Healy, add a new mapping,
so we can map that, move forward and backward, click in here and choose
move forward and backward. We want it to happen with W key, so click in here, head W on your keyboard, add
another input. Click in here, ads. So with W and S, we want to go forward
and backward. By default, for both
of these right now, if you hit them,
it will pass one. But what we want to happen whenever we hit W,
we want to pass one. Whenever we hit S, we
want to pass minus one. So in the S, we want to
add a modifier to til it to negate the value
and pass minus one. That's it. Now that
we have this event. Let's just go down in here
where we have some space. Search for IA forward
and backward, move forward and
backward, right? Whenever we hit W or
S on our keyboard, there is a node inside the vehicle movement component that is called pitch input. Search for pitch input
or set pitch input, and we can set the pitch
input with this action value. And know with that whenever we release W or S on our keyboard, this complete will happen, and we want to set this pitch input back
to zero, what it means. When we change the pitch, it means the change in
the pitch over time. So it will change the
pitch continuously. So at some point, we need to tell it to don't
change the pitch if we release the W or S on our
keyboard and we set it to zero. No with that let's just
connect this to target, head comple, save run over game. Now if we go into the sky, as can go forward just
like this Kasia forward. And we can go do as well. Little time to bio. And with that, we
can go down like this and at the space
bro down the engine. Now, what I want to do two
things that I want to do. I want to delete all
the printer strings. So in here, I will
set Control F, printer string, search
for printer string. And whatever printer string that we have, we want to delete it. No, we had a line trace in here that we had
draw debug type, that we want to put it now. So we have much cleaner
game to work with, right? No, again, we should
go up into the sky, and we can see it's ready
in the sky and stay there. That sees all. That
looks awesome. No, it's time to be
able to void and live. You try to do that
before the next bill.
26. 25 Move right and left: No, we want to be able
to go left and go right. I hope you could do
it just by yourself. Right clicking here
in the input folder, create a new input, and I want to call
it IA moving left. Right. That's it. Don't click on it to open it. The value type, I want
it to be Axis one dy. You can just save
it and close it. We don't need this metasund. We don't need these
wheels, right? No, we need to map it. So IMC hel create a new mapping. There is lots of
mapping in here. Let's just do it for IA, moving left and right. And we want to do this
with D. So click in here, add D there and add a new input, and click in here, head A. Whenever we hit D,
we want to pass one. Whenever we hit A, we want to negate it to pass minus one. That's it. Or input action
is ready, we can use it. Let's go here that
we have some space. Search for a moving left, right. But where you name this
event, it doesn't matter. It is okay. Like
we did it before. This time we want to roll. We want to change the
rotation around the X axis. This is called roll. So again, we need to get
vehicle movement component. And search for roll input. Set roll input by
action value, right? And whenever we release
D or A on our keyboard, this complete will happen, and we want to set
this role to zero, set it back to zero. So put it to zero in here, and it needs a target as well. That's all we need to do. Let's just compile,
save and run. Let's go to the spy. I see the dust it is right, let us go and
everything is all fine. The next thing that we do we want to be able
to turn in place. Whenever we had E, we want to
turn in place to the right. Whenever we head Q, we want
to turn in place to the left. You try to do that.
We will do it next o.
27. 26 Turn in place: No for turning in
place left and right. For doing that, again, we
need the input action, create the input action in
here and I want to call it I turn left right. Click on it to open it.
And the value type, we want it to be
float like before, and we need to map it here because we have
lots of mapping in here. We need to use this scrollbr and what we want to map is
called turn left and right. Again, let's just
go down in here. How we want to turn
left and right, we want to do it with
E. So click in here, add E, add another input. This time, click
in here, head Q. Whenever we hit Q, we
want to pass minus one, so add modifier of
type of negate. That's all we need
to do in this. So we can just close
the input action, but leave this open for no. Now in here, we want to
right click search for IA turn left and right. And with that, again, there is a node inside the vehicle movement
component that with that, we can change the rotation
around the Z axis. What it's called,
it's called ya. So we search for Ya set Ya
input by the action value. Let's just put it
there. No, when we release the Q or E
on our keyboard, this complete will happen, and we want to set
the Ya input to zero. That's it. Now, with that done, if you run over game and
go to a Skype that's. O, see, it's not rotating. And for it to turn and rotate around the Zs we need to go to vehicle
movement component, you remember we did the pitch turkey scaling
and roll turkey scaling, and both of them
are working fine. But we didn't do turkey scaling. We need to put this to one. That's why I leave
this one for later, so you will see the
effect of these inputs. Now, with putting one in
here, it should work. Let's just head
compile, save and run. No, if you go to the sky, you can see it can
turn in place. That looks awesome
afford and you can turn in place when you
are going forward see, I can shoot everything now. I think it's time to shoot to be able to fire missiles, right? That's it. We turn is all fine.
28. 27 Helli missile: No, we want to actually
fire over missiles because, you know, every fighter
helicopter has some missiles. So for firing missiles, we need a missile. So let's just go
to Content drawer, go to Blueprint folder
inside the heli folder. Right click in here, create a blueprint class
of type of actor, and I want to call
it BP, heli missile. I'll click on it to open it. In here, first thing
first, I want to add a skeletal mesh because
missile is a skeletal mesh. Make it as default sin
root, and in here, click in here and choose or
SK west missile 26, right? Choose it there.
No you can see it. I want to add some
Niagara effects, right? So add the Niagara in here. The one that I want
to use is called NS West Missi 26.
You can see it. No, I want to put
a socket there. The socket that I want to use is called root joint socket. Now, you can see with putting
it at the right socket, the positioning of
it and rotationing of efface is okay.
You can see it. Now with that done, we need to be able to fire it. For firing it, I on use a
projectile movement component. And in here, I need to put some initializer
speed like 20,000. And the max speed I want
it to be 50,000, right? You can change this
later if you want. Now, for seeing it correctly, let's just go behind it
and click on simulation. You can see how good
it looks, right? No, I want the rotation
follows the velocity. So the rotation, it always is toward where
it's going, right? Now, again, let's just de
everything will be the same, but it will look
much better again. No, with this missile, we need to add some sound.
29. 28 Missile Sound: No, we have a missile, but our missile
doesn't have sound. Let's see how we can add sound. For doing that, I want to go to contender or go to Helfolder. Go to Sound folder. Right click in here, go to audio and create a metasund source. I want to call it
s Missile, right? Dog click on it to open it. In here, first, I want to
create a wave player, right? Type of mono. You can do a stereo as well. Connect the play to play of it. The sound that we
want to play first is rocket and PT,
this one, right? Just with that,
let's just connect the OT mono to here and play. You can see, it's like a
starting of our Missi, right? We can just use that, but
I want to make it better. How I want to make it better, I want to create another
wave player, right? And with it, this time, what I want to play
is rocket engine. And we need both of
these to be played. So I can use a mixer in here. Mixer two is more than enough. It will mix both of
these t mono together, and we don't need to
change the game at all. But if you play this one, let me click on this
magnify glass and play it. You can see it sounds
like it is two second, 3 seconds after firing
over missile, right? So we need to delay its trigger. How we can do it in here, we can search for t gear delay. And let's say after 1 second, we want to play this one, right? And we want this
one to be on loop. Now what will happen if
you play this first, it will shoot and
after 1 second, it will play the
continuous rocket engine. So that's what we
want it to happen. No, let's just add it to our heli missile
and add a audio. It should be a child
of the skeletal mesh. I want to call it engine. Sound. It is rocket sound, but I will call it engine sound because it's easier to
understand it, right? Engine one that
you want to play, click in here and in here, choose MS Missile, right? Just with that, if
we simulate in here, let me head F. If we
simulate in here, there will be no sound, right? But if you go to our map, and let's just put it over here, this is our player start. And if you put one of
the missile in here, let me put this one in here
and rotate it 180 degree, bring it up a little bit like this and rotate it toward
up like this, right? If we run it shooting and
we can hear the sound. But the problem is it is
farther away from us, but we can hear the
sound completely. And how we can fix this problem is with
attenuation setting. If you go to our BP missile
and click on Engine sound, you can see there is
attenuation setting in here. So for changing that, I want to go to sound folder in sight or helfolderR
click in here, go to audio and create
a sound attenuation. I want to call it
SA Missile, right? SA for sound
attenuation, miside. And in here, we have inner
radius and fall off radius. If you are inside
the inner radius, we can hear the
sound completely. And I want to change
this to 10,000. It's like 100 meter, right, because it
is in centimeter, and the follo distance
or fall of radius, I want to put it
on 80,000, right? You can play with these values. No, with this sound attenuation, we can go to over hell missile, click on engine sound and choose assay missile for
attenuation setting. You know if we go back,
you can see we have an inner radius and
we have outer radius. If you are inside
the inner radius, we can hear it completely. But if we get farther away
from it to the outer radius, we linearly hear it less, right? Now, with that done, if
we run our game, see? It shoot, and when it
gets away from us, we can't hear it more. But if there is some player
farther away from us, they can hear it, right, if the missile get
close to them.
30. 29 Missile Explosion: Know where missile is working, it has sounds, but when it hits something,
nothing happens. Let's just test that out. For testing that oat, let me bring it up like this and rotate it
toward the ground. If we shoot and see it
will go under the ground. Let's see how we can fix that. Go to BP hell Missile, click on the skeletal
mesh, go down. Until you reach the
collision preset, right now, it is no occlusion. That's why it won't
hit anything. What I want to do with this, I want to change this
to ignore only pawn. Now, if you go here,
you can see it will ignore the pan,
ignore the vehicle. Okay? But it will
block everything. Now with that, if you
compile, save and run, you can see I go on underground
and it will stop there. Let's just go on. We
have a la right here. So it will stop there. Whenever or missile stop, we can do some stuff. For example, if I click
on projectile movement, we have projectile stop. Click on it to create
its event, and in here, we want to break
this impact result, right, expand it like this. First thing that
we want to do when or projectile,
stop by something. Want to spawn explosion, spawn system at location. And the system that you want to spawn is dust explosion.
Let's just put it there. The location, we want to use the location that it
stop there, right? And that's it. Let's just
head compile and run. You see, you know,
it has explosion. Next thing, we want
to spawn some sound. So spa sound at location, right? This spa sound and location, I want to use ES
grand explosion, and the location of it, we can use this location. But I want to
expand this and use the attenuation setting that we create for the missile
as well, right? So if it explode farther
away from us, we don't hear. After this, we can just
destroy the missile. So search for destroy actor
and destroy the missile. Now if you're on, you can
see it will hit the ground. We have explosion. We have explosion sound, and the missile is deleted
and destroyed as well.
31. 30 Fire missile: No, that over missile is ready. We wanted to be
able to shoot it. Let's see how we can do that. For doing that, I want
to go to a level and delete this hell missile
from over level. We don't need it anymore. Go to Heli folder, go to Inputs folder and create a input for shooting
the missile. So creating input action, I want to call it a fire. Don't click on it to open. We don't need to change
anything in here, so we can just close it.
Close this one as well. Close this one as well.
We don't need it. Go to IMC hell. We want to map it inside or IMC hell input
mapping context. So let's just create a
new mapping, and in here, the one that you want to map is called IAFre. So let's
just put it there. And in here, when do
we want it to happen? Whenever we hit Leftmost button. So click in here after
that hit Lift Most button and we'll put the leftmost
button there. That's it. No, with that don't go to
BPlly, find some space. We can just close
these two as well. These No in here, whenever we hit
Lift Most button, this IA fire will happen. And whenever we press it, we want to spawn
some missile, right? So how we want to spawn it. If you go to Viewport, you can see we have the right side and we
have the left side. So we want to be able to fire it from both missile system
at right and left side. So first one from
the right side, second one on the
left side, right? So whenever we hit the start, I want to use flip flop
in here, flip flop node. What this will do
first time that we hit leftmost
button, A will happen. Second time that we hit
leftmost button, the B happen, third time that we
hit leftmost button, again, the A happen
again, right? It will happen after each other. So what we want to do, we want to spawn
actor from class. And what actor is
called Missile, right? So healing missile, just put it there and connect it to A. But the transform of it, where to expan it is
really important. Where do you want to spawn it? If you go to skeleton of or helicopter and search for
missile inside the bones. You can see we have left missile socket and
right missile socket. We need the names of them. So right click Rename socket. And again, right click on it, copy the name for the lph one. Let's just do it for the IF one. We want to get the transform of that socket on our skeleton. So we need to get the mesh. Socket transform, get
socket transform. It needs us to provide the name. We did copy it, so control
V to paste it over here and connect it to
spawn transform, right? This is for the left one. Let's just copy and
paste all of it and paste it over here for
the right one as well. The only thing that we need to change in here is this name. Let's just go to a skeleton. We want to do it for the right
missile socket, as well. Rename it, Control C to copy the name and paste it
over here. That's it. Everything should work fine with this if you had
compile save and run. Let's just go into the sky. And shoot. And it's
heavy as well.
32. 31 Number of missile: No, we are shooting our missile, but the problem is we can
infinitely shoot our missile. So we need to have a system so we limit the amount of
missile that we can shoot. And for doing that, I want
to create some variable. So in here, create a variable. I want to call it number
of missile, right? And the type of it, I want
it to be integer because it can't be 1.5 or 0.5, right? We don't have a decimal value. Next, I want to duplicate this, I need another variable. And I want to call this one
max number of missile, right? Maximum number of the missile. Let's just compile, save the
maximum number of missile. I wanted to put
it on ten, right. First thing that you
want to do with this, I want to go to event
begin play in here, and I want to set the number of missile with the max number
of missile at the begin play. So whenever we had play, all of the missiles
will be there. We have lots of missile, right? So the number of missiles at the begin play,
it will be ten. And for you to see it, I want to show it over here at Eventq with a printer ring. But this time, I want to create a custom event for
debugging, right? Right click in here, search
for custom event, right? And I want to call
this one debug, right? And in here, I want
to connect this debug to our
eventqEecution path. So put the debug there. No, whatever we connect to this debuke it's like
connecting it to Eventq. I want to use a
printer ring in here, printer ring, and with that, I want to give it a key. We wanted to show the number of Missile. You can put whatever
for this key that you want. It's just for no
engine to know that this printesin should
be persistent and it shouldn't fill up the
screen with it, right? No, I want to use a format text, format text, and I want to say
missile number is equal to open and close
curly braces number or whatever you want to put
inside these curly braces, it will create a pin
for that so we can replace the curly braces with the number inside it
with the pin that we have. These curly braces with
the number will be replaced by whatever we
connect to this number pin. The reason that
it's called number because we put number in here. The name is really
important in here, right? The number that we want
to show is the number of missile connected over here
and connect it to a string. Just like that, head
compiles, save. Now, if you run over game, you can see the number of missile is ten, so
it's working fine. Now that we are showing
the number of missile, we want to go here. And whenever we head fire, head leftmost button
on our keyboard, we want to decrease the
number of missiles. So get the number of
missile subtracted by one like this and save it
inside itself again, right? So we decrease it with that connect it like
this to here and here. Now, if we head compile you can see we have ten missile. If we shoot, we have
nine, eight, seven, six, five, four, three,
two, one, and zero. You can see it can
go minus as well. So we don't want it to go minus. So what we can do, we can check the number
of missile in here. So check it with the
branch, and with it, we want to say if the number of missile was bigger than zero, you can shoot the missile. Now, if you had compiled save
and run we game and shoot, you can see we can shoot just ten. And after that, we can't shoot anymore, no matter how many
times you want to hit leftmost button,
we can't shoot.
33. 32 Reload missiles: No, for reloading or missile. Let's see how we can do that. For doing that at
the begin play, let's just go at the begin play. When we set the
number of missile, we want to set a timer. So in here, set a timer
by a event, right? And this timer, I want to
happen every 1.5 seconds. So we need to put 1.5
there and make it loop. So every 1.5 second happen
again and again, right? And what will happen this
custom event will happen. So we can add the
custom event to it, and I want to say reload. So this reload execution will
happen every 1.5 second. And now with that we want
to check if the number of missile was less than
maximum number of missiles, so we need to get both
of these and check. If the number of missile is less than max number of missile, we want to increase it. We should check
this with branch. So if the number of missile was less than max
number of missile, we want to increase it, right? And how we can increase it, we can get our
number of missile, add one to it like this
and save it inside itself. So with it, we are
increasing it. Save it like this, connecting it like
this and connect it to true. That's it. Now, if we help compile, save and run over game, you can see the number of
missile will stay at ten. But if we shoot some of them,
you can see it is five. Now it is six, no it is
seven, no it is eight. Now it is nine,
and now it is ten, and it won't increase
more than ten. Now, we have a reload
system, right, that we can shoot over
missile completely, and after 15 seconds, we can have all
the missiles back. And you can see we are
reloading the missiles. No, we can shoot again, right? No, with that done, our
reload system is okay. No, it's time to
add some UI to it, so we can see it
in our UI as well, not just with a string.
34. 33 Missile UI: No next thing that
you want to do. We want to create a
widget Blueprint UI for our missile system. So let's see how we can do that. Go to Content drawer, go to Hell folder, right click in here, create a new folder and
call it Widgets. Head inter to open it
right click in here, go to User Interface and create a Widget Blueprint of
type of user widget. I want to call it WBP UI, right? Don't click on it to open it or head inter to open it, right? In here, first thing
that you want to add, we want to go to panel at the Canvas panel inside
this Canvas panel, I want to first
show an image after that X and after that,
a number, right? So for doing that,
I want to create a horizontal box by
defaulct up there, but I want to change
the anchor to bottom right corner and change the position X and
position Y zero. Now, you can see it is
aligned by top left corner. I want to align it with
bottom, right corner. So put one and one
for alignment, so it will put it on
bottom right corner. Now, I want to add
some padding with positioning -50 and -50. So we have some space between our horizontal box
and the border, right? Next, I want to add an image. So let's just go up, add an image like this
and choose an image. In Brush, click on image, and the image that you
want to add is missile. So search for
missile is this one. No, you can see it is stretchy. We need to click on
Horizontal box to tell it. Consider the size of the
content that you have, right? You can see? No, the size of missile is good,
but it's too big. So what I want to do
I click on the image, go to image size and divide the Y by two. Divide it by two. I think that looks
much better, right? Just with that, we need to add a text as well in
horizontal box. You can see it will
go after the image. And for the text of it, I want to use an X like this, and I want it to be aligned to the middle like
this. You can see. I want to change the colors to something more black like this. But you decide what
you want to no, I want to add another
text over here. You can see, again, it
will be after those, and I want it to be aligned
that middle like this. And I want to put a value there, for example, ten to see
if it looks good or not. No, what I want to do
I want to click on the X and add some padding. For example, pad to left, five unit and pad to right, five unit as well.
What I want to do. I want to change the size of the ten because maybe we can see it. For doing that, go
to appearances, go to font and change it
to whatever you want. I want to put it on 88, so we can see it better. That looks, I think, good. I want to name this text
to number of missile text. Okay? And I want it
to be a variable, so we can change it later. Head compile save. Now,
if you go to graph, what I want to do in here, I want to create a function. So with that function,
we can update the number of missile text
inside OUI, right? I will call this function, update number of
missile and with it, we want to set the text on
our number of missile takes. So get that variable, set text on it, and it is down here, set text. With this, we can set the text on our number
of missile takes. But with what? With the
input of this function. So click on the function, go down and create a input on call this one number
and the type of it, as you know, I want it
to be integer, right? Head compile save and connect these directly
to here, right? Know that we have this, we have a UI, and we have a function
to update that UI. Let's see how we can use it. For using it, we need to
go to BP hell at BMP. You can see after we set the
number of missile in here, we want to create
a widget first. So in here, we say
create widget, right. With the widget that
you want to create is called HeliUI choose it there. No, we want to first promote
it to variable and I want to call it hell UI, right? I need the execution pin. So let's just give it
the execution pin. And after that, we want to add these two viewports
so we can see it, right, add the viewport
and after that, we can set the timer for
reloading the missiles, right? Now with Teton, if you
hit compile save and run, you can see the missile UI is there and we can
see it. That's good. But it's not updated. Let's see how we can update it. Whenever we change the
variable number of missile, we need to get the hell UI. And code the update number
of missile function. That's it. That's
all we need to do, right with the
number of missile. And we need to copy and paste
this at the end in here. When we shoot our
missile at the end, we want to update the number
of missile again, right? So control we paste
it over here. In both of these cases, it doesn't matter
which one happens. We want to again, update the number of missile,
right? Just like that. You know that at the
beginning, first, we check if the number of
missile was bigger than zero, we decrease it by one, and we shoot it and spawn it. After that, we update the UI. Now, let's see if it's
working fine or not. If you run over game, you can see the
missile number is ten, and it's showing it in
bottom right corner. Let me go to a sky so
you can see it better. And shoot, you can see, I'm shooting and no, you can see the
number of missile is changing perfectly fine. So no, we don't need that text, that print testing, right? The missile UI is working fine. So no that missile
UI is working fine. We can just disconnect this. We don't need it anymore. It was just for showing
you how it works.
35. 34 Crosshair: Know that we are able to shoot our missile and there is a limitation for that and
we have reload system. We need a UI. So with that, we know
where we are shooting at, where our missile will be
after one or 2 seconds, right? So for doing that, I want
to go to Content drawer, create another Widget Blueprint. So right click in here,
go to user Widget and create user Widget
right, Widget Blueprint. After that, click
on user Widget. I want to call it WBP AM, right, or whatever
you want to call it. The only thing
that I want to add in here is just an image. Don't worry about anything. The image that I want to put in there is called
cross hair, right? That's it. You don't
need to change anything. I want to change the tint
to a black color like this. But if you don't
want to do that, just leave it as it is. Just with that head compile, save and close it. Now, we need to go over BP hell and add a user
widget over here. So click on AD search for
widget and add a Widget. And I want to call this
1:00 A.M. As well, we can call it MI, right? Click on the MUI and change the space
from word to screen. So we always see it, right. After that, we want to
change the widget class to the one that we create
WBPAM and the size of it, I want it to be
100 by 100, right? That's it. But you
said compile, save. And Runo game, you can see the widget is there.
That looks good. We didn't change it to black, but let me show you something. If we again open up the WBPA, we can click on Image. And change the tint
color to black. But first of all, I want to
change the opacity of it, so it will be a little
bit transparent. Now, if you run over game, you can see, that
looks much better, but my taste is like this to
change it to a black, right? I think with our
fighter helicopter, the black is much better,
better suited, right? But you can see the position of AUI or crosshair is not okay. So let me show you how
you can change that. If you go to BP Hali, what do you want
to do we want to go to even tik and each tick, we want see where our
helicopter is looking at and change the crosshair or
AM widget to there, right? So for doing that,
I want to create a custom event down here, right? We have some space in here. Let's just create custom event, and I want to call
it AI manager. AMUI manager, and we want to connect it
to Eventq as well. So in here, we will drag and draw up and search
for UI manager. That's all we need
to do. No, in here, what you want to
do we want to use a line trace line
trace by channel. As you know, it needs
to start and end point. The start of it, I
want it to be at the middle of our helicopter that we can use a spring yard for that because it is at the
middle of our helicopter. So let's just use that. I will get our
spring yard and get the word location off of
it, get word location. This is the start
point like this. Next, the endpoint,
we want it to be aligned with our helicopter
at front of our helicopter, where it something
or not, right? So for doing that, first, we need to get this spring
arm forward vector. So search for G forward vector. And because this is
a length of one, we need to multiply
it by some value. So multiply it by
really big value. So change this to
a float and put 99999999 there,
right that's good. Whatever value you put in here, it should be just big, right? And now, with that, I want to add this start location that we have to the or
forward direction. And this is or end no, right? For you to see it,
I want to change this Droid dvc type
for one frame. And just with that, let's
just see what will happen. If you head compile, save
and run, you can see, no, there is a line from the
middle of helicopter to front. If we go into the sky, you can see if it
hits something, it will give us that
location, that square. So with that square, we want to set the position of where Mui or cross
here to that position. For doing that, we need to break these out head
results, so break it. With it first, we want to check if it hits
something or not. So check it with the branch. If it hits something, so it will give us a impact point or the location that it
hits something, right? We can use both of them. Now with that, we can
get our MUI and set the word location.
Okay, that's it. Connect the truth to it, and the impact point is
more than enough. Now, if it didn't
hit anything, again, we want to set the word
location like this. If it didn't hit anything with the trace end where
the trace end, that end of that line that
we saw together, right? No, just with that, if you hit
compiles save a Runo game, you can see the position of
or cross head, no is okay. You can see if we go to a sky, you can see every time
is okay and it is at the right spot and we
can shoot there, right? Because we are moving,
it won't do good, but you can see, it's working fine, right? So we turn off the engine. Shoot. No, you can see, it's heading close
to it. It's okay. Because with this helicopter, we will have app
radio damage, right? This is how it should works. So that looks awesome. No, we have a UI. What I wanted to do,
I want to disable this draw deba type to none because we don't
need it anymore. We want our game to look clean. You can see no, it is
much cleaner, right? You can see everything is
working fine and beautiful.
36. 35 Anti air gun Blueprint: Our helicopter is ready
to destroy some stuff, but we don't have anything. So let's see how we can create an enemy that
can fight back. For doing that, I want
to go to Content drawer, go to Anti irgonFolder,
and in here, right click, create a new
folder and call it blueprint. Or blueprint. And I'll click on it to open it
right, click in here, create a blueprint
class of type of actor, and I want to call it
BP anti air gun, right? Do click on it to open it. In here, first and first, I
want to add a skeletal mesh. So add it there and put
it as default syndroot by dragging it and
dropping it on default scene after that, click in here, choose
the SK east art. You can see it over here. With this, we want to
attack the helicopter. Maybe we can destroy it. Next, this one because
we wanted to rotate it's gone and face helicopter, we need animation
blueprint for it. For doing that, I want
to go to Content Drawer, right click in here, go to animation and create
Animation blueprint. For the Scale East RT, selected, help create and I want to call
it ABP ti air gun, right? I'll click on the top
and this one as well. In here, we want to add
the mesh space, R pose, this will give us all the
information about the bones, and we need to connect
it to with pose as well. No anti ergon
Blueprint is ready. Let's just add one of
them to our level. Where over player start, click on player
start on Outliner, head F. So you will
go to player Start. I want to create over Antirgon by dragging up one
of them in here, right? That's it. It's
facing over player. I don't want it to
face over player. Let's just rotate to whatever
rotation that you want. So with the animation blueprint, we want to change
the rotation of it so it will face over helicopter
and attack it, right? So no next thing that we want to do we want to tell it
what is your target. For doing that, I want
to go to BP Anti Airgon, go to AventGrap and in
here on Event BM play, I want to tell it that the
BP hell is your enemy. And if it is in range,
shoot at it, right? So for doing that, in here, we need to get the player pawn, and with that, it
will give us the pawn that these player start will
spawn automatically, right? It will spawn it over here. And with it, we want
to cast it to BP hell. Okay. If the casts successful, it means the target is there, and we can shoot at it, right? So we can right click on this as BP Heli promoted to a variable, and I want to call it target. So this is our target, right? No next thing that we want
to do with this target, we want to check if it is range. If we can shoot at it, and how we can do
it, we want to say, if the distance
between the tiegon and the Taya that is or BP
Holly is 100-8 thousand, for example, you
can shoot at it, but if it is not in this range, don't shoot at it
because you can't? So for doing that in here, I don't want to do
it every frame. I want to use a timer, so set timer by event. We want to check
at every 1 second. We want to check every
second to see if the helicopter is
in range or not, if we can shoot at it or not. So this set timer by event, give us a event and we can
connect a custom event to it. So search for custom event, and I want to call this
one check in range, right? You can name it
whatever you want. This check in range will happen
one time after 1 second. But if we enable the loop, every second, this checking
range will happen. And with this checking range, what we want to do we
want to get the distance. So let's just search
for distance. Between two vector,
distance vector, we want to check the distance between anti ergon
and the target. If it is in range,
shoot at it, right? So it needs two vector. First vector, we can just get the actor location that will give us the location in the
word of over anti ergon. Next, we want to get
the target and get the actor location
of that as well, get the actor location
of over target. No, this will give us the
distance between them. But before doing that, we need to check if this
target is valid or not. So search for is valid,
right, like this. If it is valid, get
the distance between the antagon and the target
that is over hell, right? So in here, we want to
check if it is in range. So search for range in range
fluid because it is a fluid, we want to say if it
is 100-8 thousand, it is in range, right? So if the target is valid, we want to use a branch in here and check if it
is in range or not. And in here, just for no, I want to use a print test ring. And if it is true, it means it is in range. So let's say in
range, that's it. And if it is false, again, let's just use a print
test ring and say target is not in range. And for you to see it, I want to change the color of this print test ring
to red and head okay. Now, if you head compile, save and run over game, you can see it says target is not in range because we
are not close to it. But if we get close to it,
let's see what will happen. Should you go closer? No, you can see we are in range. If you get away from it, let's see what
will happen again. You can see it is in range, and no it is not in range. So based on the distance, we are deciding if it
is in range or not. This is the first step toward our goal to shoot
at our helicopter.
37. 36 Modify gun bones: No, we know when the target
is in range of anti air gon. But first thing that we
want this antiirgon to do is to look at the
helicopter, right? Face it so it can
shoot at it, right? Right? No, it's facing this way, but we want it to rotate
it to face the target. Doesn't matter where it is, it doesn't matter if it's
move wherever, right? So for doing that, we need
to use animation blueprint, and the node that we want to use is called modify boon, right? And with this modified bone, we need to change the
rotation of over gun. So we don't need to
change the translation, so we can tell it not to
expose it as pin, right? And we don't need to
change the scale as well. So they'll tell it not to
expose it as a pin as well, but we want to
change the rotation. And the rotation mode, we wanted to add
it to existence. So if it already has a rotation, it will add to it
and after that, choose the bon space, right? You can just leave it as
component to space as well. Now in here, the bone
that you want to modify, we can put it over here. But let's see what bone
we want to rotate. If you click in here,
it will open up the skeleton of over gun, right? In here, we have a gun
joint that with it, we can bring it up and down. You can see. And we have a
turret joint that with it, we can rotate it
around the Z axis. This rotation around the
Z axis is called Yaw, and the rotation around the
Y axis is called pitch. So we need to change
the pitch of over gun and Yaw of over turret. Okay? This is our turret, and we need to change its jaw. So there is two bone that we need to change each rotation. First, the gun joint, pitch and the Turret joint, ya. So let's see how we can do that. First of all, let's
just do it for Turret, right? Search for Turret. It says torrent. It's a mistake. Don't worry about
it. Torrent joint. And in here, I want to right click on this rotation
and split the stroqm. We don't need to change
the roll and pitch. We need to just change the ya. For example, if I
change it to 40 and head compile.
No, you can see. The rotation of it is changed. Again, we can put it
on 90, for example, head compile, no, you can see, I did rotate 90 degree. I don't want to just
do it like this. I want to promote
it to a variable. And I want to call it gun Y, put it on gun ya. We don't need to say Tretyo because we are changing
the Tret ya, right? But the gun, I mean the
anti air gun, right? That's why I call it gun ya. And after that, we need
to copy and paste this. We need to do it for the
gun joint itself as well. So the bone that we want to
modify is called gun joint. So let's just put it there. Now what we want to
change is the pitch. So for example, if I put 45 there and head
compile no you can the pitch of it is
changed 45 degree. Again, I want to right
click on this one, promoted to a variable, and I want to call
it gun pitch, right? That's what we need to change. Gun pitch, and gun ya. For testing them in an in preview editor,
we can just test them. For example, for
changing the pitch, you can see, I'm
changing it in live. And I can change the ya as well as you can
see it over here. I look at it, you
can see it better. You can see, with
these variables, we can rotate our gun and change its pitch to
look up and down. So now that we have a
way that we can rotate our gun and change its
pitch to look up and down. Let's see how we can
calculate what should be the pitch and what should
be the U in next video.
38. 37 Calculate gun direction: No we know how we can rotate our gun into whatever
direction that we want, right? But no, we want to check the target and change the
rotation based on that target, so gun AMAT or target. For doing that, I want to
go to BP ti airgun in here. Instead of just using print toring what I want
to do I want to create a variable and say
if it is in range or not. So name it is in range. If the target is in range, we want to set this to true. Target is in range,
if you remember, we check distance between
the antigon and the target. And if it is in range, this true will happen, and we
want to say it is in range. After that, if it give
us false, this branch, we wanted to say, it's not in range because this
gives us false. That's why this false often happen and we say is
in range is false. Now with that on
Aventq at each frame, we want to change the
rotation of over gun so it will look at the helicopter
or the target, right? So first thing that we
need to do in here, first, we need to check
the target if it is valid. So search for I valid like this and connect the
execution pin to it. Next, if it is valid, we want to check if it
is in range or not, so we get it and check it
with the branch like this. No, in that case, we need to calculate the
gun pitch and gun ya, so it will look at our helicopter and how
we can do that, first, we need to get the rotation from our anti air
gun to the target. What is that rotation? If the helicopter
changed its position, what is the rotation that
our gun should have? And there is a node for
that that is called find Look at rotation. So this fine look at rotation needs a start location
and target location, and it will calculate the
rotation that gun should have, so it will aim at the target. The start location
is or anti argon, so we can get it by
get actor location. That's it. No, for
the target location, if you go to our BPL, I want it to target at the
middle of our helicopter. Or a helicopter by default, the 000 location of it
is down here, right? But a spring arm is starting
at the middle of helicopter. So that's why I want to use
the spring arm position. To say, This is your target, aim at the middle
of our helicopter. So in our anti air gun, we want to get our target
and get its spring arm. So search for spring guard. And with this spring guard, we want to get its
word location. So get word location. And no this node will give us the rotation
that our gun should have, so it's aimed at our helicopter. No, we gun already
has a rotation. And we can get that with
G actor rotation, right? We want to calculate
the difference between these two rotation and put it
for gun pitch and gun yeah. And how we can do that,
there is a node that is called Delta rotator
that will give us the difference
between the rotation that we should have the
anti air gun should have, so it will aim at helicopter and the rotation that
it already has, right? I will give us that rotation. We can just right, click on
this one, split a stroke fin. Now with this, the only
things that we need is the pitch value
and the ya value. So we can right click on the pitch value
promoted to variable, and I can call it gun pitch. This is the pitch that
our gun should have. We need to save the gun pitch by connecting
execution pin to it, so it will save the
gun pitch inside it. We need the Ya as well, and I want to call it gun Yao? And connected to
execution pin as well. Now, we have the gun
pitch and gun ya. Let's see how we can use it
in our animation blueprint. Go to Animation Blueprint, go to event graph, and in here first, we need
to get our BP anti air gun. So right click in here at the
event begin play like this, and we need to get
the owning actor. Like this and cast
it to anti ergon cast to anti Air gun, right? If this casts successful, we can promote it to variable. And I want to just call it
BP anti Air gun, right? Inside this BP anti
ergon, what we have, we have the gun
pitch and gun yacht, that we calculate, right? So in here, we don't need
this trig pawn owner because the owner of
this animation blueprint is a actor class. That's why we did use
owning actor, right? And in here, first,
we need to check if this anti air gun
blueprint is valid or not. So search for is valid. If it is valid, what we want to do is just
connect the execution pin. We need to get the
gun pitch off of it. So search for gun pitch, and we need to get
the gun ya, as well. Gun ya like this. These are the values that
we calculate in here. These are this one, right? But we want to
connect it or save it inside these variables that we have it inside our
animation blueprint. So we can get our gun pitch, set it over here with
the value that we get from our anti air gun that we calculate
together, right? And again, we should do
it for Gun ya as well. Set it over here with the
value that we are getting from over Anti ergon
Blueprint. That's it. Now with that done. We
need to go to or Antirgon, click on or skeletal image. We did forget to put
the anim class there. So click in here and
choose ABP anti ergon. So this blueprint and this animation blueprint will be connected together, right? With that done, no,
if you run over game and go into
the sky, let's see. It should change its rotation
based on our location. Now, you can see it. It's
facing us. Go forward. You can see or Antiergon
is looking at us, and it will change its rotation, so it will look at us. Again, let's just
go into the sky. Doesn't matter where we go, you can see, it's
following us correctly. Now that it is
following us correctly, we need to fire the
guns at our helicopter. Let's see how we
can do that. Next.
39. 38 Anti air gun projectile: No for our anti air gun to be able to shoot
at our helicopter, we need a projectile. So first, let's just create a projectile and after
that, we shoot it, right? For doing that, go
to Content drawer, go to Blueprint folder in Anti Airgun and
right click in here, create a blueprint
class of type of actor, and I want to call it BP anti air gun project
tile, right? Doll click on it to open it. And in here, the only thing
that I want to add is just a sphere because it will go so fast,
we can't see it. We don't need attic
image for it. Just a sphere is
more than enough. I can put it as a
default syn root by dragging and
dropping it there. Now, with that, I want to add a projectile
movement as well. Add a projectile movement. And the speed of it, the initialize a speed, I want it to be 40,000, but you should play
with this value until you reach the
result that you want. The maxim speed, I want
it to be 50,000, right? And now with that, if I go toward the direction
and hit simulate, you can see or
projectile is moving. Now, the next thing
that I want to do I want to change the
size of the projectile. So for doing that,
click on sphere. Size for all of them, I want to change at 2.15, right? That's why I did
select these icons, so all of them change together. 0.15 is more than enough because it is a small
projectile, right? The color of it for that, I want to create a material. So in here, I will click
create a material. I will call it, red. That's it. I'll
click on it to open. And in here, what I want to
do I want a whole tree on our keyboard head
leftmost bottom to create a constantr
vector that with it, we can change the color if you connected
to the base color. Now, we can click in
here and choose the red. Just add red to it. You can see no it
is a red sphere, but I want it to glow
a little bit, as well. That's why we need
the emissive color. We can just connect
these to emissive color, but it won't glow that much. Let's just see and look at it. You can see it's
glowing a little. But if you multiply this by really big value,
like, let's say, 200 and connect it
to a missive color, no, you can see it
will glow more. Make sure you save it and
go to antiirgonPjectile, click on the sphere, and
change the material to red. So we put the red there, right? Now, with that, I want
to change the collision. Right now, it's blocking
all the dynamic. I want to change this
to a custom preset, and I want to block everything. But the collision enable of it, I want it to be query only, so it won't physically
push or helicopter, it will create a lot of bots. That's why we want to
put it as query only. And the object type, we want it to be more dynamic, and we want to block everything. That's it, that
was for collision. Now, let's just head
save and compile. Go to Aventurap in here, whenever or projectile
movement is stop, we can go down and get
this on projectile stop. So we have event whenever or projectile
at something, right? In here, we can just break
this out had result and with we want to apply some damage when it
hits something, right? So say apply damage. The amount of damage that
I want this one to cause, I want to put it on 0.5 for now, but we'll change it later. And to what actor we want to apply damage is the
actor that we hit. So dragon drop the
head actor to here. After we apply a damage, we can just destroy it, right? Destroy actor. That's
all we need to do. No, let's just head
compile, save. Nothing will happen because
we are not spawning yet. But again, if you go to our
viewport and head simulate, you can see how it looks like. You can see. No,
let's see how we can spawn it. We
will do it next.
40. 39 Fire the guns: No for a spawning
or projectile and shoot toward our helicopter. Let's just go to our BPN tigon, make sure you save everything. And in here, whenever
the target is in range and we set
is in ranged true, we want to set a timer. So set a timer in here. By event, each 0.05 second, we want this event
to happen on loop, and it needs a custom event. So let's just add
the custom event. I want to call it fire. So with this timer, every 0.05 second,
we fire over gun. Either the right
side or left side. You can see there is
two barrel in here. So either one of these
doesn't matter, right? No, we have this timer. We can just promote it to
variable because at some point, we need to stop this timer. And I want to call this
fire timer, right? And if the target gets
out of the range, we want to get our fire
timer and in here, clear a toad, clear and
invalidate the timer. No, with that done,
let's just use a printer string for
no and say fire, right, and at compile and
save to see what will happen. Right now, because the
helicopter is not in range, I wouldn't say anything, but if we get close to it,
let's see what will happen. It says, fire, fire, fire, and if we again, get out of the range, the timer will stop. Let's just look at
it. No, you can see the timer did stop and no
it's not firing at us. Now with that, we know it's trying to fire at us
when we are in range, and it won't fire at us
when we are not in range. No, we don't want
to use a printers. We want to spawn some
bullet, some projectile. So for doing that,
we need to get the position at tip of
these two barrel, right? At tip of these guns. So how we can do that,
there is lots of way. I want to show you a new way. In here, we can just
click on skeletal mesh, add a scene component in here. This is just for location. This one, I want to
use it for left gun. Just put left on there. And because it is child
of skeletal mesh, we can assign a socket to it. So in here, I want to
assign it to gun joint. Now, you can see it is
aligned with our gun joint. We can bring it up and put
it at tip of the left gun. The left con is this one, right? So let's just put it
on the right position. It's 230 minus ten, right? Now, let's just
duplicate this and do it for the right gun as well. So control D to duplicate it and change the name
to right go, right? Again, the parent socket, we want it to be gun
joint like this, and we want to bring it
on this side, right? Now, you can see the right
gun is at the right place, and left gun is at the
right place, as well. Now, we have the
places that we shoot fire up or a spawn
or projectile. No, with that,
let's just go here. On this fire, what we want to do we want to use a
flip flop, right? First time we want to
spawn on the left side, second time we want to
span on the right side. That's why the flip
flop will works good. So no, let's just do
the left one first. In here, I want to spawn
a actor from class. The actor that you want to
spawn is called projectile. It has projectile inside it, anti air gun projectile, right? For transform, because we want
to do it for the left one, we get the left
gun, and with it, we get the word
transform off of it, word transform and we can
just connect it to here. We want to do the same for the B or the right
barrel or right go. So Control C Control
V to paste it over here and
connect these to B. Just change the left gone
that we have in here to right gone to get the word
transform off of it, right? Now, with that, let's
see what will happen. If we compile and run. No, if we get close to it, let's see what will happen. If we go. No, you can see
it is hitting us, right? But there is no effect. It's just hitting us
with some bullet. There is no sound.
There is nothing. And you can see if
I get away from it, it won't be able to fire at us. You can see it's firing
at us. It's fire at us. No, because we get away from it, it won't be able to fire at us because we are not
in range anymore. No, the problem with this approach is that
it's too accurate. It's hitting us always. We need to find a way
to shoot it in a cone. So not all of these
bullets hits us. So it should look more natural to miss some
bullets, right? The real anti argon
is like that. There is some tolerance, and next video, we will
add that tolerance there.
41. 40 Randomize direction of projectiles: No for spreading
these projectiles that we are spawning
because it's too accurate. It can destroy us if there is more than
one of them, right? It shouldn't be
this much accurate. So for changing the
accuracy of them, what I want to do first, let's just do it for the left barrel. I want to bring a topic in
here and what I want to do. I want to disconnect this and on a right click on
this return value in here, split the rock pin, and with it, I want to make a transform
in here as well. Make a transform
down in here, right? So if we just connect
everything location to location and rotation to rotation and scale to a scale,
nothing will be changed. Let's just look at it.
Nothing will be changed. It will be able to look at hit us completely fine
with lots of accuracy. You can see how accurately
it's hitting us, right? But what I want to do, I want to change the rotation to have some
tolerance, change the rotation. I don't want to change
the location or a scale. I just want to
change the rotation. And for doing that, first, I want to get the forward
vector off of it, and I want to randomize this forward vector to look a little bit
left right up and down with the node
that is called random unit vector in a
cone in a radius, right? So what it will do this
is our forward vector, it will add a little bit
tolerance to it in a cone, a cone that is like this, right? The tolerance that I want
to add in there is I want it to be really small because if it is
one degree in here, it will be a lot
farther away, right? So I will put it on 0.08, really a small value. So what this node will do, it will randomly each time add some tolerance to
the forward vector, so it will shoot everywhere. It will spread the projectiles. After this, we can create
a rotator off of it. We can say rotator from
X, right? That's it. X is forward vector. That's why if we create
make rod from X, it will work, and we want to
connect it to the rotation. Just with that, if we hit run and let's just
get close to it, the right gun should be hitting us accurately,
but the left gun, you can see, it's
hitting everywhere, and there is less
accuracy on the left gun. Of course, if we
get close to it, there will be more accuracy. But if we get away from it, you can see, No, there is lots of tolerance, and it can't hit us always. No, I want to do the same
for the right side as well. So let me bring all
of this in here. I want to delete this,
copy all of these, Control C control
paste it over here. What I want to change is just this left gun that you
want to change it to right. No, let's just say that out. If you run we game and get close to it, let's
see what will happen. It will spread all
of the bullets. You can see it's not
hitting us always. That looks much more realistic. In real life, it's like that. It's not that accurate. Let me see it one
more time in here. If you get close to it. And you can see it is shooting
us in all directions. If it shoot us directly
at us with accuracy, pinpoint accuracy, we
will die in no time. That's why I did add
all of this tolerance, so it looks more natural.
42. 41 Anti air gun VFX: No, it's time to add
some visual effects. Let's see how we can do that. For some visual effects, let me go to content
drawer in Assets folder. If we go to vehicle
East Art in effet, you can see there is
a ***** system in here that we can use it for shooting or gun
visual effects. Let's wait until it compiles and now you can see how
beautiful it looks. It has everything for us. You can see that looks really awesome. We want
to use that, right? So let's just go to our
antiirgon I want to click on the right gun and add the Niagara system
there. That's it. The Nagara system, it automatically put it there
because we selected over here. That's why it did
automatically put it there. But I want to call it
right muzzle, right? Right muzzle. And it did
put it correctly there. The rate of fire it's
more than enough. No. If you look at it, you can see it's
spawning it down there. But because it is child
of the right gun, we can just put the position
to zero and zero and zero. Now, you can see it is
at the right position. That looks awesome,
right? And you can see there are some shells
ejecting as well. That looks really awesome. We want to do the same
for the left gun as well. So control D to duplicate. And this one, I want to
call it left muzzle. So should change that to lift muzzle and put it
as left gun in here. And again, click on it, change the position to
zero, zero and zero. And now, if you go
here, you can see, for both of them is working
fine at the right position. Both of them are shooting. Everything looks good, but if we run over game,
it's always shooting. You can see, it's
always shooting. We don't want it
to be like that. We want it whenever it's actually shooting to
have that visual effect. And how we can do that,
it actually is easy. So in here, by default for both of these left
muzzle and right muzzle, we wanted to say, don't
be activated by default. So change the auto
active to false, and now you can see,
there is no effex there. And if you run a game, you can see there
is no effex there. But whenever it start firing, we need to activate them. So we can get both of them like this and set active on it, set active that's it. And we want to activate. Then when the helicopter is in range and we want
to start firing, right? Both of them, we want
it to be active. And we can just copy and paste this and paste it over here. No, we need some space. Let me select all of this, add some space in here. And whenever the target
is not in range, we are not shooting at it, so we want to deactivate these
two visual effects, right? And that's all we need
to do. Let's just head compile, save and run. You can see by default, there
is no visual effects there. But if go close to it. Let's see what will happen. No, you can see,
it's shooting at us, and there are visual
effects as well, and that's working fine. No, over visual effects
is working fine, but it's not playing any sound
when it's fire a weapon. Fire, it's gun.
Now, let's see how we can add some sound to it.
43. 42 Gun fire sound: No, there is some visual
effects anti Argon, but we don't have any sound. Let's see how we can
create the sound. Go to content
drawer, and in here, go down to Argon, and in here, right click,
create a new folder. I want to call it sounds. Okay. Double click on
it to open it, right, click in here, go to audio
and create a metasund source. I want to call it sti
air gun fire, right? Double click on it to open it. And in here, I want
to use a wave player. Like, always, we start
from a wave player. The wave that you
want to play is called 50 BMG if you play it. It's just like that, right? And next, we want to connect
the oat mono to oat mono. And this time, unfinished
to unfinished, right? When we are looping something, we shouldn't connect
the unfinished at all. But if you are not looping
something and we want something to happen once we connect the unfinished
to unfinished. No, because we have
just one sound in here, it won't sound that good. So that's why I want to
randomly change the pitch. So in here, I will search
for random float, right? And this random float
will give us a value 0-1. I don't want it to be like that. I want it to be between
0.1 and two, right? It will randomly
select a float value. And give it to us in here
and we set it as a pitch. So each time that this metal
sound get to be played, it will have different shift. No, these need a tree pin, so let's just give
it the tree pin, and after that, play the sound. Now, if you had play, you
can see, it's working fine. No, let's just head safe
and see how we can use it. Go back to BP Anti Argon. And in here, in both
of these cases, we want to spawn
sound at location, spawn sound at location. And the song that we want to
play is called MSOntiRgnFre. For the location, we can
use the location that we pass to this Span
projectile note, right? We can just drag
and drop this and break this and use
its location, right? Next thing that I want to do I want to add
attenuation setting. We have it from before. The SA missile works
for this one, as well. So let's just put it there. Now with that done, I want
to copy and paste this one in here as well for
the right gun as well. I need a location. We
can just break this off and use its location
for the location. And the sound attenuation
is okay, as well. No, let's just test. If you had compile,
save and run over game. Right now, there is no sound
if you get close to it. You see there is sound note. And if you get away from it, the volume of the sound
will be changed as well. I want to change some stuff. This sound attenuation
that we are using in here is not
enough, It's not good. Let's just create
sound attenuation just for this right
click in here, go to audio and create
a sound attenuation. I want to call it
aa gun fire, right? Don't click on it to open it. And these values, let's just test it just with these values. Go back to BPT Airgon and choose the sound attenuation that we create together and
in here as well, sound attenuation need
to change it to gunfire. Now, let's just test that out. If we run we game, let's just get close to it. You can see, there is no sound, but if we get close to it, we can hear it no. You can see the
sound attenuation right now, it's too much. It's 400 is a lot less
than what we want. Maybe 1008 thousand is better for inner radius
and outer radius. Let's just test that no. If we run over
game and go to it, there is a little bit sound, and the sound get
heavier and more volume, and you can see that, I think, sounds
much better, right? So the 1008 thousand is more than enough.
You can just close it. One other thing that
I want to do in here because we are using
a timer in here. On this fire, again, I want to check if the
target is valid or not. If we don't do this, sometimes
it can give us an error. So we get the target and we check if it is
valid or not, right? And connect it like this. If it is valid, we
can fire at it. But if it's not
valid, we don't fire, and what we want
to do, we want to disable the visual effect. Control C Control V to paste these visual effects new
active to faults like this. So if the target get to be destroyed and this timer
doesn't know about that, it will give us some warnings. I don't want you to
have those warnings. That's why we check if it
is valid at every fire. That will prevent lots of bugs.
44. 43 Helli health system: No Antigone is hitting us. Let's see how we can have a health system
for showing that, for decreasing the health
of our helicopter, right? For doing that, I want to
go to BP Hell and in here, go to event graph,
find some space. For example, in here, right click event
A damage, right? And I want to use
a printesn just in here to show the damage
that it causes us, right? If you run our game, no and get close
to our antiirgn, let's see how much
damage it will give us. 0.5 every time, right? That doesn't sound good. So what we can do, we can go to Event Craft and randomize
this base damage. So what I want to do in here, use a random float. But I want it to be
in range, right? I don't want it to be too much. I want it to be between
0.3 and 0.8, right? Just like that, let's just head compile save and know
if you run over game, every time it will give us a different damage,
right, randomly. And you can see it is a
value between 0.3 and 0.8, and you can see how much
it is giving us, right? No, it that do we don't
need this printer string. What I want to do, I want
to create a health system. So let's just create a variable and I want
to call it health. Right? And the type of it
I want it to be float. Next, let's just
create another one. This one, I want to call
it max health, right? No, the max health, I want it to be for no. Let's just say 80, right? Whatever value that you
want, you can put in there. And the health, I want
it to be 40, right? That's it. Now with that done. First, we want to check if
the health is more than zero. So in here, we check if the
health was more than zero, let's just use a branch. Like this. If the health
is more than zero, we can decrease the
health like this, get it, subtracted by
this damage number. After that, save
it inside itself. Save it in here like this. Cool. After that, we want to
check the health like this. If it is less than
or equal to zero, we want to save with the branch. That it is destroyed. And in here, let's just
use a printer string. Hell, destroyed. We don't want to
destroy it just now, but you can see the point in
the health system, right? Now, if you had compiled
save and what I want to do, I want to go to DB that
debug that we create, that we showed the
missile number. This time, I want to
show the health, right? And the value in here, I want to put zero
in there so we can use it for other
things, right? And for the key, I will
just put a string there. That's it. No, we want
to show the health. So let's just put health there and connect the
execution pin to it. Let's just he compile and run. You can see the health is 14. If we go close, you can see how it is
getting decreased. You can see it's 25 and no, it's a he destroyed. Or helicopter health is
decreasing until it's destroyed. Now that we have
a health system, we need to create a UI for
it. We will do it next.
45. 44 Health bar UI: No for adding a health bar. Let's see how we can do it. Where do I want to do it? Let me go to Hali
folder in widget. We had a WBPHAUI. I want to add a
health bar up here. So for doing that, we need a progress bar added
to the Canvas pile. The anchor point looks good. I want to add some
padding to it, 50 and 50, I think is good. So we have some padding or a space between the
border and our health boar. Now, the size of it, I want
it to be 800 by 20 like this. You can see. And let's just
change the percent to 0.5. You can see the percent
is a value 0-1. If you put 0.5 there, the half of it will be full. Now, for the color of it, I wanted to put it on green. So put the green to one
and put the blue to zero. So it will give
us a green value. We can make it
dark a little bit, so it looks more
beautiful. That's it. No, for it to look better, I want to go down
in the transform. First of all, I want to change the pivot to zero
and zero, right? By default, the pivot
is at the middle, but I wanted to put it on top left corner with
zero and zero, right? After that, I want to
share it a little bit like this, 35, right? I think that looks awesome. Now, with that done, we
need to name it something. I want to call it
health bar, right? And we need it to be a variable so we can update its value. So let's just go to graph. Like we did it for this set
takes over number of missile. We need to create a function
for this one, as well, and I want to call it
update health, right? And the input of this
is a float value. So change the type
to float and I want to call it health right? This health should
be a value 0-1, because we want to set the health progress
bar like this with set percent,
this value, right? Connected like
this. So we should remember that this
health is a value 0-1. For you to remember it, we can click on the function and go to description in here to say health is 0-1, right? Put it there, no
head compile, save. Now that we have that
if you run over game, you can see the
health board there, but it's not updating. If we go to our BP hell, wherever we are
changing the health, we need to update
the health as well. Where we are changing
the health in here. After we change the health, we need to update the health. Let me make some space in here. We have the LUI so get it, and there is a function inside it that it's
called update Health, and we know that the
health is a value 0-1 inside or a helUI because
it's just a person, right? But right now, the
health is a value 0-80 because the maxf is 80, so the health is a value 0-80. How we can change
this health based on the max health 0-80
to zero to one. How we can do that, we can get our health like this
divided by max health, divided by max health, and it will give us a value 0-1. If the health is zero, zero, divided whatever it will give us zero, health
will be zero. If the health is 40,
that by default, it is 4040/80, it will give us 0.5 and health
will be at 0.5. But if the health is 80
and the maxelf is 80, 80/80, it will give us one. Another thing that I want to do, I want to copy this one, and at the begin play, let me find the
begin play in here. We want to update the health
before all of this, right? We want to update the health
with the value that it has. Control V to paste it over
here and update the health. Now, if I change the health 40-20 and head compile
and run over game, no, you can see the progress
bar or health bar is at 20%. No leashes get close
until it destroy us. You can see the
health is decreasing, and after that, it
says, heal destroy. So that looks awesome. We have a health bar, and no when the
health reaches zero, we want to destroy our helicopter. Let's
see how we can do that. Next
46. 45 Destroy Helli: No for destroying our helicopter whenever the health reaches
zero or less than zero. Let's see how we can do that. For doing that, first of all, we need a destroyed helicopter. Let's just go to Content
drawer in Blueprint. I want to right click Create a blueprint class this
time of type of actor, and I want to call it BP
damaged Healy, right? I'll click on it to
open it in here. I want to add aesticmsh because damaged helicopter
is in estaticmsh. So add estatic mesh. I want to drag it and put
it as default scene root. And here the estatic mesh
that I want to use is called Hell damage SM
west heli damaged, and you can see it over here. Now, I want to add cascade
particle system to it, add it there, and the
cascade system that you want to spawn is this one PS
wreckage hell, right? Just put it there. Now, this
is the blueprint that we want to use whenever our
helicopter got destroyed. But click on the static mesh and tell it to simulate
physics as well. So if you are in a sky and we spawn this
destroyed helicopter, it will hit the
ground after that. No, let's just at compile, save, and you can
just close this. Now, if you go to BPHlli, I want to create a custom event for destroying or helicopter. So in here, I will right
click create a custom event, right, and save
destroy Hale, right? Destroy it Hali. And in here, first thing that I want to do, I want to spawn a system
at location, right? Create a explosion, and
the system that I want to use is called
Niagara Dust explosion. And the location of it, we can get the actor location, get the current actor
location that this will give us that and
connected to here. Next, I want to spawn a sound, so span sound at location. And the sound that
we want to use is called ES grand explosion. That's it. And the
location of it, we can use this
one. And that's it. No, next thing
that I want to do. The final thing, I want to spawn that actor that
we create that is called damaged
helicopter, right? So click in here and search
for damage damage hell. Just put it there. For
the span transform, we can get the actor
transform just like that. And after all of this, we can destroy our
helicopter completely. So it will spawn another actor and it will
destroy the main helicopter. Let's just head compile, save. No, instead of this printer string that we say heli destroy, we want to use destroy Healy, not destroy actor, destroy Heli. Let's see what will happen. Head compile save
and run over game. Now, let's just get
close to over tier gone, so you can see it
did destroy us, and you can see how beautiful it looks. That's really awesome. No helicopter can be destroyed.
47. 46 Helli tip over damage: No, I want to destroy our helicopter whenever
it's rollover. Let me show you where. If we get in the
sky and we do this, we want the helicopter to get destroyed as well.
So how we can do that. For doing that, I want
to go to viewport, so you can see the blades. I want to click on mesh
at a capsule collision, add the capsule collision. And I don't want to
name it anything. I want to use a parent
socket of rotor main joint. Now you can see it
up here, right? I want to rotate it like this
90 degree around the Yaxs. It means the pitch, right? Know with that, I want
to position it better, bring it up like this and change the
halt until it reached, for example, here, right? And know with that,
if I go here and tell it not to be hidden
in game, what will happen? It will rotate with blade.
You can see it over here. It's on our blade. If we start the engine, you can see it is rotating
with or blade completely. I want it to be
hidden in the game. So know whenever this capsule
collision hit the ground, we want to say destroy
the helicopter, right? So in here, I want to go to vent graph and in here, go down. Until you reach the
collision preset, I want to change it to custom. We wanted to say
overlap everything, but don't overlap
with the vehicle. And the collision of it, I want it to be collision enabled query and
physics. That's it. No with that done, we
can go down and have the component begin overlap,
right? Just like that. Let's just use a printer ring in here to see if it's
working fine or not. Printer ring. Say hello, right? If we run over
game and tip over, let's just see what will happen. It doesn't say anything because our level or landscape is
ignoring the collision with it. So for fixing that, click on the landscape. After that, in detail panel, go down until you reach
the collision section of our landscape in here and tell it to generate
overlap event, right? Tell it to generate,
and that's it. Now, if we hit save
and Runo game, no, if you tip over, let's
see what will happen. It should say hello, right? It's say hello. You can see it. No, we know that our capsule is detecting if you are tipping
over to the ground, right? But one other thing
that I want to do, I want to cast this other actor that this capsule collide with two BP anti air gun
projectile while I'm doing it because the anti air
gun is shooting at us and if one bullet goes
through this capsule, it will destroy our helicopter. We don't want that to happen. So with this cast, we check. If it is anti air gun
projectile, don't do anything. But if it's not anti
air gun projectile, if it's whatever, you can
destroy the helicopter, right? Destroy hel, in that case. Now with that, if you run
over game and get close to our antiirgon or anti ergon can shoot at us and
decrease our health. You can see it is decreasing our health and
destroying the helicopter, but it's not destroying it because it's
shooting at the blade. Now, if you tip over, we'll see what will happen. And you can see, no, when we tip over, we are
destroying the helicopter. The problem with
this right now is that the help is not
updating when we destroy it, and the number of
missiles is there. So let's see how
we can fix that. For fixing that, where
we are destroying the helicopter in here
before destroy actor, what we want to
do we want to get the UI and set the
visibility on it, set the visibility to not be
visible completely, right? To be hidden. We don't need
to change the health to zero. Just change it to hidden, right? Now, if you have compile and run and tip over, let's
see what will happen. You can see the
health bars go away. No, we have a printer
that we want to disconnect it because I
want my game to be clean. So this showing the
health. No, that's it. Whenever a helicopter tip over, it will be destroyed as well.
48. 47 Projectile hit helli sound: No next thing that I want to do whenever these anti
gun projectile hit us, we want to have some song. So for doing that, before
destroying the projectile, what I want to do, I want to spawn a sound at
location, right? On what location on the impact point location where it hit the helicopter, right? The sound that you want to play, if you go down, it's
called metal hit. If you play it, you
can see, that's it. That's what we want to use. And I want to
randomize the pitch of it so it wheel
looks more natural. So in here, I want to use
a random float in range, and I want it to be between
0.1 and two, right? No with that done, if you hit compile save a Runo game, let's
see what will happen. If we go into the sky, you can see, when it hit us, there is a sound, but there
is lots of these sounds. It's not okay. What
I want to do I wanted some of these sounds to happen and some of
them don't happen. And how we can do
that, let's see. I want to use one of these
random float in range generators node like this
random float in range. And I want this
value to be 0-100, so you will
understand it better. So what I want to do, I want to check
this random number each time that it
hit the helicopter. And if it is greater than 80, we want to check
it with a branch. Right? We want to play the
sound, spawn the sound. But if it get to be false, just destroy the actor, destroy the projectile,
and don't play any sound. So what will happen with this? In 20% of times, there will be sound when
projectile hit the helicopter. But on 80% of times that
projectile hit the helicopter, there will be no sound, and it sounds more
natural this way. If you run a game
and look at it, let's just get close to it. You can see, sometimes it's happening and sometimes
it's not happening. And that, I think,
sounds much natural. But if you want it
to always happen, you can just connect
this to here directly. You don't need to do this.
49. 48 Destroy anti Air Gun: No next thing that
we want to do. We wanted to be able to destroy the anti air gun
with our helicopter. Right now, Antiirgon can destroy us and we can
destroy ourself as well. But we can't destroy the anti air gon. Let's
see how we can do that. For doing that, I want
to go to Content drawer, go to AntiirgonFolder,
go to Blueprint first. We need to create the
damaged anti air gun, right? So right clicking here, create a blueprint class of type of actor and I want to call it BP. Damaged, anti air gun, right? Don't click on it to open it. In here, I want to
add a static mesh. Just like that, I
want to dry and drop it and put it
as default snroot. The static mesh that you
want to put in there is called SMEs art damaged, right? This is the one. It's just
some material, right? So now with that, we need to add a Niagara effext as well. And for the effex that
you want to span is called NS East RT
damaged. That's it. That's the blueprint
that you want to create for damaged
antiairgun, right? No, with that done, we need to actually apply some damage
to our anti air gun. And when the missile
hit the antiirgon, we want to spawn the
damaged antiirgon, right? So for doing that, we need
to go to Hell folder, go to Blueprints and open
up the our missile system, right, the missile in here. Before spawning
everything, I want to create a space in here. When the projectile stop,
what do you want to do? We want to apply radio damage. So search for apply radio damage at the beginning of
this event, right? The location that we want this applied damage to happen is the location that this projectile
or missile stop, right? So the location is
more than enough. The base damage just put
some value, 25, for example. The damage radius, I
want to put it on 600. So with this damage radius, if this missile explode
in the radius of 600 centimeter or six meter
close to our anti ergon, the anti argon will
be destroyed, right? Next, the ignore actors. I want to create a
self reference to self and make an
array off of this, make array just with this input and tell
it to ignore itself. And the damage causer, we wanted to set it as well to be this hell missile, right. Now with that done if you go to anti air gun and find
some space in here, for example, and search
for radio damage, we have event radio
damage, right? So in here, let's just use
a printer string and say anti air gun, destroy it, right? And I want to make it red, so you will see it better
like this a run over game. Now if we shoot close
to it in 600 radius, close to it, it
will be destroyed. But right now you can
see, we are hitting it, but it's not saying the
anti air gone destroyed. The reason that
it's not happening, the radial damage
is not happening, it's because the skeletal mesh. If you go down on detail panel, you can see it
says no collision. Just change it to custom because it is no
collision, right? And first and first, collision enable, we want it to enable collision
to collision enable, and we want to change
the object type from word estatic
to word dynamic because aploal damage is not working with
this word estatic. It will ignore it,
right? Now, with that down let's just he compile, save and test it one more time. If we go into the sky
and shoot it, no, you can see it is saying, Anti air gun is destroyed. And you can see
it's working fine. No, we don't want to just
say anti air gun destroyed. What we want to do whenever
the missile head close to it, we want to spawn or
damaged actor, right? So in here, search for damaged, damaged anti air gon, and for the transform of it, we can get the actor transform. And after spawning this, we can just destroy it,
right? Destroy actor. Now, if we run a game, let's just head it to
see what will happen. You can see it got
destroyed. Can see it? That looks awesome. We did
destroy the anti argon.
50. 49 Fix collision of anti air gun: We have some
problems. Let's see. If we run over game and
go toward anti irgon, you can see, there is sound, but the help is not decreasing. What is the problem? If
we go to Anti Ergon, do you remember we
click on Skeleton mesh, and we did go down and
change the collision. And because we are
blocking everything, the projectile block with it. So what I want to
do to fix this, I want to tell it to
ignore everything. Theatic mesh of this anti ergon, ignore everything, right? Just with that, if we go into
the sky, just look at it. No, it can again hit us, you can see, I can hit us and
we can destroy it, as well. But it's hard to destroy it because the health
is not too much. Let's go to BP hell
and change the MxL to, for example, 300 and change
the health to 200, right? So we have some
help to play with. Now, if you run over game,
let's just destroy it. To see if it gets
destroyed, you can see, no, it's back and help is decreased, but we can destroy it as well. We don't need that collision
to block everything, so we can hit it, right? No, that's good. Let's just add some more. Hold Alt, drag and drop, and create another one. Hold Alt again, drag and drop, create another one,
give it some space, so not all of them. Shoot us right, like this. No, with that done.
Let's just run a game. Just get close to it. Now, you can see this one, and lots of them are heating us. I did destroy one of them. Let's just go and back. One of them is destroyed. That looks good. Know
what I want to do. I want to go to damaged
helicopter. Let me find it. Go to Content
Drawer, go to hell, go to blueprint and inside
the damaged helicopter. If we spawn the
damaged helicopter, it means the game is over and the
helicopter is destroyed. So what I want to
do, I want to set a timer in here by event, and after two second
restart the game. So after 2 seconds, this custom event will happen. So let's just create a custom
event and reload level. I name it reload level
for our custom event. And in here, what I want to do, I want to open the
level by name. The level that I want to
open is called New Map. So let's just put
it there new map, no, with that, if you compile, save, let's just go to war. And here, the best strategy is to go from left to
right, but that's okay. It's not destroyed. No, I
did destroy one of them. They are destroying me, right? Get away from them and get back. On to shoot them from
far, rotate like this. And let's just try to shoot
from far away. That's it. Yeah, this one is
destroyed, as well. Let's just go and get back
again like this rotated. And let's just go
for another one. And we got destroyed. After 2 seconds, we
will respond, right? That's good. The level
will be reloaded. Again, let's just
destroy this one. This one is destroyed.
Let's just go to this one. Destroy this one. And this one is
destroyed as well. Just one other one we have. Let's just go close to it so
he can shoot at us, as well. There is just one of them, so it's easy to shoot at, right? That looks perfect. We destroyed all of them. Congratulations.
51. 50 Rear rotor movement: One thing that we should
add to our helicopter, but we didn't done it. Let's just see. If
we run our game, you can see the rear
rotor is not rotating. If we go up, you can see the rear
rotor that is a problem. Let's see how we can fix that. For fixing that, go to
animation Blueprint. And in here, you can see, we did rotate the main joint. No, we want to rotate
the rear rotor, this if you click in here, we go to a skeleton, and in here, if you
search for rotor, you can see there
are lots of them. But the one that we want is
called rear rotor main joint. So we want to
rotate that, right? First of all, let's
just duplicate this, modify bond, Control C, control V to paste it over here. And when you paste that in here, connect the execution, pin
to it, right, like this. We want to change the
pitch of rear rotor. First, let's just choose the rotor that we
want to rotate, rear rotor, main joint, right? After that, we can use
this rotor value for the pitch of our rear rotor, right, because it
should be pitch. If you click on it in here, again, just search for rotor, rear rotor main joint, head F, so you can focus on it. And you can see this
green one is the pitch. Now, if we test that
eran or game over here, and that's you can see,
it's working fine. The spin of it, it's not that. But we can fix that, it's easy. We can go to ABP hell and
multiply it by some value. So for example, five, right, and connect
it to the pitch. Now, let's just tatote. If we run over game in
here and go into the squa, you can see it is
okay faster and in