Transcripts
1. 00 Promo: In this course, we're going
to talk about disruption, building destruction or
whatever destruction. We start with creating a APC that can go forward,
backward, left, right. It can shoot at the stuff and
it has handbrake as well. We create that for testing
or destruction system. After that, we go to
some basic stuff. For example, some sphere, how we can make
them destructible. After that, we will
talk about how we can change the damage
threshold of them. So some of them we
can hit them by car, and it will be destroyed. And some of them because
the damage threshold of them is a lot, we can't break them easily. And with this damage threshold, it can resist the
explosion as well. So some of them will
destroy much easier, and some of them will
destroy much faster. We will talk about how we can change the strength
of these explosions. After that, we will go
to anchor fields or we can use them to stack things
at top of each other. After we learn all of
these basic stuff, we will go and
create a building. We're building have some
columns, some glasses, some wood, and some concrete that each one of them has
different damage threshold. So, for example, if
we had at the middle of a building where
there is no column, it will be destroyed
a little bit, but it won't be collapsed. But if we hit a column,
it will collapse. And whatever that is
based on that column, it will collapse as well. So if you want to add some
destructibility to your game, let's start this
course together.
2. 01 Create destruction project: For this project, I'm
using ARIA Engine 5.5 0.3, so download it and open it up. In here, you can go to Game
and create a game template. I want to use the blank project because it will be easier for
beginner to understand it. So click on Blank. We want to do it in blueprint. You don't need the
starter content at all. You can tell it where do
you want to put it by clicking in here and choose
where do you want to put it. After that, we can
call it a name. I want to call it
destruction, and head Create. And this is our project. Now that our project is opening a description
of this video. There is a zip file that
is called apc dot zip. Download it, put it on your
desktop, and after that, right click on it and head extract or you can just
click on it to open it. It will open it in
Windows Explorer and you can drag and drop it, so it will be extracted. This APC folder is
really important. Inside that there
is a Assets folder, and the path should
be exactly like this, so it will work, right? Now that the APC
folder is extracted. Go to the project. Click on Content
drawer and in here, right click on Content folder and show it in Explorer, right? Know in here what
you need to do, just drag and drop the APC folder inside
this content folder. And that's all you need to do. Now, if you go to
content drawer, you can see the APC
folder in here, but if you don't click on it,
there is nothing in there. If you restart your unreal
engine, it will work. But for now, just
leave it like this. No next thing that I want to do. I want to create a new level
because these open Words, for some reason, is not working with geometry
collection and all of that. That's why I will go to file, go to new level, and in here, create a basic
level and hit Create, right? This is the level that we want. We can click on this floor in here and make it really big. So click on it, go to detail, and for DX scale, I
want to put it on, for example, 500 for the Y, 500 and for the Z, you
don't need to change it. That's all you need
to do. Head save. I will tell you where
do you want to save it? I will save it in
Content folder. So click on Content folder, Headsaf and it will be saved. Now, go to Edit Project setting. Now in here, go to maps
and modes and change the editor starter map
from the open Word to new. Right? There is a
Bargain Area engine 5.5 0.3 that when you change
this, it will go to non. So again, you should click on
it and choose the new map. So again, in here, choose it. I will go to non and after that selected, it
will work, right. Now with that done,
you can just close it. Next thing that we want to do, we want to go to Edit, Editor preferences and in here, search for open whenever
we open something, we want it to be open
in the main window. So in the asset
editor open location, change the default
to main window. No, it will be
easier to work with. Next thing that we want to do, we want to go to Edit plugin and in here, search for chaos. Okay? And if you go down, there is a chaos
vehicles plugin. Make sure you enable that after that head and
restart URL engine. I know or project will be ready so we can create
or destruction. And here, the real
engine is open, the plugins are enabled. You can go to Content
drawer. The new map is here. If you go to APC into Asset, the vehicle you can see in here, we have a vehicle in here, the skeletal image of a vehicle. Why we need this vehicle
for the destruction? Because we need
something to be able to shoot at the building
that we want to destroy. We want it to be destructible. So that's why we want
to create this APC. But if you want to just
continue with your own game, I will create a
projectile for this APC, for this vehicle, so you can use it inside
your game as well. It doesn't need to
be just the APC. The projectile of this
APC is important. So if you want just
the destruction part, you can ignore the APC part.
3. 02 APC blueprint: No first thing that
we want to do. We want to create a
blueprint for our APC. So go to APC, folder in here, right click, create a new folder
and call it lueprint. So all of our blueprints
will be here. We will be organized, and we can migrate the to another
project and use it, right? It will be easier. So know in here, right click, create a blueprint class, and for the type of it, go to all classes and in here, search for Well wheeled
vehicle pun and head select. And I want to call it BP APC. You can call it
whatever you want. D click on it to open it
or head inter to open it. No, we need to decide a mesh. Click on the mesh, and in here, choose a skeletal mesh
of our west APC, right? No, let's just look at it. That looks beautiful, right? No next thing for you
to be able to see it. I want to click on add and
add a spring arm, right. And after that, click on the spring arm and
add a camera, right? You don't need to
change the name of spring arm and the camera. By itself, it's good, right? The length of or spring arm, I want it to be 700. I want to add some offset to the socket of O Sprinarsvill, in direction of Y, for example, 330 maybe, right, like this. And I want to bring it up
a little bit, like 200. No, that I think is good because I want to see the
barrel of the gun, right? No, I want to bring it up a
little bit because I want it to be at the middle of
or APC, just like that. And I think that is
better for you to see it. I want to go to Contender or right click in here and create another blueprint class of
type of game mode base, and I want to call
GM for game mode, BP for blueprint APC, right? So with this game mode, we want to tell it to use this BP APC as your pan as
your playable pawn, right? So go to default Pan class
in here and change it to BP APC and now you can
head compile, save, and close this and go
to level and in here, go to word setting and change the game mode override
from none to GM BP APC. Now, if you run over game, you can see or APC, but you can see the
wheels are not okay. It's not rotating correctly. Nothing is right. Okay?
So let's just fix that. If we go to BP APC in here, we have a vehicle
movement component. I don't want to use that. What I want to use,
I want to click on add and search for chaos. And the one that
I want to use is chaos wheeled vehicle movement. Just add this one, and in here, we need to tell it which the bones are your
wheels, right? So in chaos wheeled
vehicle movement, there are a wheel setup. So we need to set up that. How many wheels we have? One, two, three, six, right? So let's just add six
of them. We have six. No, each one of them
needs a bone name. So let's just find
out the bone names. For doing that, go
to Content drawer, go to APC folder, go to Assets, go to vehicles, and in here, open up
the skeleton, right? And in here, I want
to search for wheel. You can see there is one, two, three, four, five,
six of them, right? No, the front ones, I want to use it for
steering and the back ones, I want to use it for going
forward and backwards. So motor should affect
these back ones, right? Now, with that done, let's just find
out the front one. This one, RT wheel one joint. Right. Click on it, copy
bone name and go to BPAPC. I want to put it for the
index zero bone name, Control V to paste it over here. That's finished. Now, let's
just go to the next one. I want to find the left one, the front left one. And what is that? It is left wheel or
LF wheel one joint. You can see right
click copy bone name, go to BPAPC and paste it for the index one bone
name, right? That's it. Now, let's just
do the index two. How many more we have? We have left field two, left field three, right wheel
two, and right wheel three. So we can copy one of these copy bone name,
left wheel two. And paste it over here. This is left wheel to joint. We want to do it for
index three as well. For the left wheel
tree joint this time. You don't need to go
there and copy the name because it has just a
number difference, right? After that, right
wheel to joint, right click copy bone name. And know in here we go to index
four, paste it over here, and for the index five, we know that we should
increment the number to three. That's it. Now, all
the wheels are set up. No, just with that, with those set up, we can head safe, compile, go to our level,
and run over game. Now, you can see the wheels are okay and it's working fine. But it's a little bit in the
ground. We will fix that. But as you can see, the wheels
are not rotating weirdly. That's a good step
toward the goal.
4. 03 Wheel class: Next thing that you want to do, you want to fix the wheels. Right now, if you run a game, you can see the wheels
are inside the ground because the radius
of them is not okay. So for fixing that, we should go to content drawer, go to a PC folder, go to Blueprint folder. And here, right, create
a blueprint class. We need to create a blueprint
class for the wheels. So in here, search for
wheel and choose chaos, vehicle wheel and head select because it
chaos vehicle wheel, I will call it CWE. After that, I want to
call it front wheel. Okay? And don't click on
it to open it in here. I want to change the radius
to something like 50, right? I want to tell it to be
affected by handbrake. Don't be affected
with the engine, but it should be
affected with steering. And the amount of steering
for this vehicle, I don't want it to be
more than 30 degree. In future, you need
to change that because if you
increase that a lot, it won't look natural. The wheels will go through
the body. That's why. So just with that, let's just go to BPAPC, click on Caos wheeled
vehicle movement. And for the front wheels, these two first one, right, right wheel one joint and
left wheel one joint, we want to change
the wheel class to the CWV front wheel, right? For both of them, we
want to change it to CWV front wheel. Just with that, if you have
compiled save and Runo no, you can see the front wheel
is not in the ground, so it working fine. No, we need to do the same
for the rear wheel, right? So we can click on this one, control the duplicate it, and rename it to rear wheel, not front wheel, right? So change the name. To rear wheel. The click on it to open it. The radius 50 is good. We want it to be affected
by handbrake as well. We want it to be affected
by engine, as well. So with the engine,
it will rotate. And I want it to be ABS enabled. And after that, the
affected by steering, I wanted to make it off
because we don't want it to be steerable or rotate
right and left, right? That's it. Head compile, save maybe in future, we'll change these values, but for now, it is okay. Make sure you go to
file, save everything. Now go to BP APC. We can just click on
the rear wheel class in here and after that, go for the other indexes for the rear wheels and click on this arrow to set the
rear wheel class there. Click on this arrow for
all of them like this. Now if you had compiled
save and Runo game, you can see, all the wheels are okay and it's working fine. Now, next thing, with the most, we need to be able to
rotate around APC. Let's see how we can
do that in next video.
5. 04 Look around APC with mouse: No for us to be
able to look around over APC with the
most, we need input. So for doing that, I want
to go to Content drawer, go to APC folder, right click in here and create a new folder and I want
to call it inputs. So all of our inputs
will be here. First thing that you
want to add in here, we want to go to input, create input mapping context, and I want to call
it IMC, APC, right. Input mapping context for APC. After that, right click, go to input and
create input action, and I want to call it IA L around or whatever
you want to call it. Doll click on it to open it. The value type, I want
to change it to axis two D or Vctor two D because
the most has X and Y. So we want to pass the
X and Y over most. Make sure you head safe. No, we want to map it
inside or IMC APC, so doll click on IMC
APC, add a new mapping. And in here, we want to
map the I look around. And if you expand it, the thing that we
want to map it to, if you click in here,
we want to map it to most Y to the axis. That's all we need
to do in here. And after that, go to BPAPC, go to event graph. In event begin play, we need to get the
player controller, right to tell it to use this input as a
controller, right? This input mapping context
as a controller, right? So in here, we get the enhanced
input player subsystem and we add the mapping
context to it. Add mapping context. The mapping context
that we want to add is called IMC APC. That's it. Now, we
can go down in here and search for I L around, right? The event of it. No, it will give
us a action value, vector two D, right? So we can drag and drop and break this so we have
access to X and Y. First thing first, we want to be able to look left and right. So how we can do that, there is a node
that is called at controller Ya input rotation around the Z axis for
looking left and right, and we want to use the X of
over mouse to do that, right? Now, next thing, we
want to be able to look up and down,
and for doing that, we need to add
controller pitch input. The pitch input is the
rotation around the Y axis, so we can look up and down. And we want to use the Y
of our mouse to do that. Now, if we head compile
save and Runo game, you can see we can't look around APC why we can't If we
click on spring arm, there is an option
that is called use pan control rotation. By enabling this, we tell
the spring arm to get your rotation off of the
controller rotation, and we are changing
the controller rotation with the mouse, right? So not just with that we had
compile and run over game, you can see, we can look around over APC. And
that looks awesome. But the problem is when
we want to look up, it will look down, and when we want to look down,
it will look up. If you want it like that, you can have it like that, but I want to invert it. So for doing that, I
will go to IMC APC. In here, I want to add a
modifier of type of negate. So click in here,
add negate there, and after that, expand this
and tell it to negate the Y. Just the Y is more than enough. Head save. Now, if you run
over game, you can see, I can look up and
down left and right, and everything is working fine. Next thing that we want to do, we want to be able to go
forward and backward. Let's see how we
can do that. Next
6. 05 Go forward and backward: With our APC, we want to be able to go forward and backward. For doing that, I want to do it with just one input action. So in here, right click, go to input and
create input action, and I want to call
it a go forward. Backward, right? Dog
click on it to open it. The value type, I want
it to be aces one d. Because either we are
going forward or backward, make sure you save,
go to IMC APC, add a new mapping in here. The one that you want to map is called I go forward
and backward. And in here, first thing first, with the W key, so click in here, head
W on your keyboard, we want to go forward,
add a new input. And in here, click in here, heads on your keyboard, with the S, we want
to go backward. But right now by default, if we W or S, it will give us
one in the output, but whenever we had S, we want minus one. So in the S, I want
to add a modifier, so click on modifier and
add a negate modifier. So with that, whenever we have told you, it
will give us one. Whenever we hit S, it
will give us minus one. So let's just go to BPA PC
and in here, implement that. Right click in here,
search for IA, go forward and backward,
the event, right. In here, whenever the W or S
is pressed on our keyboard, this trigger will
happen, and with that, we want to get our chaos
wheeled vehicle movement. There is a node inside that is called setrotal input, right? With this satrotle input, we can go forward. And with this action
value connected to it, it should be able to go forward. But the problem with
this satrotle input is that it is a value 0-1. And it can make our
APC to go forward, and it won't be able to go
backward. We will fix that. But as you can see, this
throttle input is a value 0-1. If you put one in the throttle in here, it will go forward. And if you put zero in there, it won't go nowhere. So just with that, if you run a game, it should be able to
go forward, right? If we had told you, you can
see nothing has happened. Why nothing has happened? If you click on the
chaos wheel vehicle, in here, we didn't
set up the engine. So go to engine
setup and in here, we need to give it a Max torque
and RPM and all of that. For example, the Max torque, I want to 800 there, and engine IDL RPM, I want it to be 800 as well. You can play with these
values, of course. Now, with that, we need a torque curve
because by default, the torque curve
is zero and zero multiplied by whatever
value, it will be zero. So don't click in here, and with that, we want
to add some keyframe. So add a keyframe in
here at times zero, we want it to be zero. And let's say after 5 seconds, we wanted to go to
full torque, right? So add the key frame. And in here, after, for example, 5 seconds, we wanted
to say go to one. One is Max Trottle
Max torque, right? Doesn't matter what
is the max torque. It will automatically
go there, right? For you to see both of them, we can click on both of these, so we can see both of them. This is linear. We
can just select both of them right on one
of them and make it auto. So it will create a curve for us so it will look more natural. That's it. No, we have a curve. Now, with that, if you head compile save and Runo game,
let's see what will happen. If you head W, you can
see it is going forward. But the problem is, it won't go backward. Why it's not going backward. Because there is a node for
going backward as volt, and the node is called set. Let me search for
it set break input. I know break is for breaking, but we can use it for
going backward, right? So connected like this. And this break is,
again, a value 0-1. So if you put one in there, it will go backward. So with this one action
value, how we can do it. Wherever we had told you, it will give us one and one for the throttle,
it will go forward. But whenever we hit S, it will give us minus one, this throttle,
because it is a value 0-1. Nothing happened to it. And this break input, again, nothing happened to
it because it is, again, a value 0-1. So what we want to do
we want to multiply this action value by minus
one. I will explain why. Multiplied by minus
one and connected to break. While I'm doing this. If we had told you this
action value will be one and one for throttle,
it will go forward. And one multiplied by minus one, it will give us minus one. And because it is a minus one and this break
input is value 0-1, nothing happened to
this one as well. But if you hit S on or keyboard, the action value will
be minus one, right? Minus one inside the throttle because this throttle
is value 0-1. Nothing happened to it.
It won't go forward. But minus one multiplied by
minus one will give us one. And one in here for the
break that is a value 0-1, it causes it to go back. Just head compile,
save and see it. If you run over game,
now you can see, we can go forward,
and after that, we can go backward as well. You can see we are
going backward with set break input, right? We are going backward. But the problem is, if we release W and S on our keyboard, again, it will continue
going backward. It has easy fix.
How we can fix it. Whenever we release W
or S on our keyboard, this complete will happen, and we want to set both of these throttle input and
break input to zero. So hold Control,
select both of them, and control C copy it. Control V to paste it over here, and connect this chaos wheeled vehicle
movement to both of the targets because these nodes are inside this
component, right? And whenever we
release W or Skey, we want to change the
throttle and break to zero. That's head compile save. And now if you run over game, we can go forward And if you release the
Olkon or keyboard, it will stop slowly. You can see it will stop slowly. And the reason is
that it stop slowly because the friction is
not too much, right? We can increase the mass. So in here, if you go down, we can change the mass
in vehicle stop to, for example, 2000, right? Just with increasing this mass, let's just test that to it. If you run over a
game and go forward, if you release the Olu ki, you can see the shark. I will stop a little bit faster. But for making it
stop much faster, we can implement the handbrake. We will do that next.
7. 06 Handbrake: For making our vehicle
stop much faster, we can add handbrake. For doing that,
we need an input. So go to input folder. Like this, right, click in here, go to input, create
input action. This spawn, I want to
call it a hand break. You don't need to go inside it. You can just save
it. You need to just implement it in IMC APC. So add the mapping in here. We want to map the
IA hand break, and when do we
want it to happen? Click in here at the spacebar. So whenever we hit the spacebar, we wanted to use handbraak. So go back to BP APC, and in here, right click
search for IA handbrake. We need the event of it, right. I don't want to use the trier, what I want to use, I want to
use the sort and complete. When this happen, whenever we press the spacebar
on our keyboard, this assort will happen. And whenever we
release the spacebar, this complete will happen. And with that, we can get the chaos vehicle movement
component and in it, say set hand, break
in, put, right? Set hand, break in, put
whenever we press the spacebar, we want it to be enabled. We can just Control C control, paste it over here like this. Whenever we release
spacebar on our keyboard, we want disable the handrake. If you had compiled,
save and run over game, let's just go forward. You can see we are
going forward, and if you release all
you can hit the space, you can see it will
stop much faster. If you go backward,
again, it should work. Again, go backward,
at the space, and you can see it
is working fine. Now the problem that we have is that where wheels
are not rotating. Let's see how we
can fix that. Next
8. 07 Wheel animation: No, we can go forward
and backward, but the wheels are not rotating. Let's see how we can fix that. For fixing that, go
to Content drawer, go to Blueprint folder. If I can find it, go to
Blueprint folder in here, right click, create
a Blueprint class, go to all classes, and in here, search for vehicle
animation, instance, right? This is really important.
We call animation instance, head select, and
I want to call it ABP for animation
Blueprint APC, right? Don't click on it to open it. It will tell you there
is no skeleton selected. Head yes to select it. We want to select our APC, so click the skeleton
for APC and head Okay. And after that, it will
be opened by itself. No next thing that you
want to do in here, we need to get the
mesh space, f pose. This will give us
all the information about the bones so we
can modify them, right? With that, there is a node that will do
everything for us that is called wheel Controller,
right? That's it. Just with that connected to output pose and head
compiled, save, go to BP APC, click on the mesh, and in here, choose the anim
class that we create together, ABP APC, right? With that, if you run over
game, just look at it. We can go forward, and you can see
it's working fine. We can hit the space
to break. You can see. We can go back for as well, hit the space again to break. And you can see the suspension knows working with it as well. And it looks awesome. No next thing that
we want to do. We want to be able to go left
and right, steer a vehicle. Let's see how we can
do that in next.
9. 08 Vehicle steering: No, for going left and
right. We need an input. So for doing that, let's
go to Content draw, go to Input folder, right click in here, go to
Input and create input action. I want to call it
IA, turn right left. I'll click on it to
open it the value type, you want it to be access
one d or float because here we going left
or right. Head save. No, we need to map
it, go to IMC APC, add a new mapping and in here, the one that you want to map is called IA turn right left. And when do we want this
to happen clicking here, head D on your keyboard. Whenever we had D,
we want to go right add a new input like this, click in here, head
A on or keyboard. Whenever we had A,
we want to go left. But by default, as you know, if we had D or A, it will pass one
in output, right? So we want to negate
the A with a modifier. So add the modifier
and click on negate. We want to negate it
whenever we had A. So whenever we had Dn on our
keyboard, it will pass one. Whenever we AO keyboard, it will pass minus one, Headsaf, go to BPAPC and in here we
want to steer our vehicle. So in here, right click, search for IA turn
left and right, right or left, doesn't
matter, right. There is a node in
the chaos wheeled vehicle movement that
is called steering. There is a steering inside it. It's called set steering input. We can just connect it like this action value to
it, right? That's it. If you run over game, let's just see head D, you can see the wheels
are going right. And whenever we head A, the wheels are going left. But when we release it, it won't go to the
middle, right? That is a problem. How
we can fix that in here, we can just expand this. Whenever we release D
or A on our keyboard. We want to change this
steering to zero, right? So we can just continue C control to paste this
over here like this. Whenever we release D
or A on our keyboard, this complete will happen and we change the steering to zero. Now, if you run over A on our
keyboard, it will go left. And when we release it, it
will go to middle again. Again, go right. Again, it's working fine. If we go forward, let's
see what will happen. If you at A, you can see, it will go left. No, you can see whenever
I D on our keyboard, it will go right and you can
see the speed is too much. And whenever we at A, it will go left. You can see it's working fine. See I'm going left, no. Now that we can steer
and go left and right, and everything is working fine. No, next thing that
you want to do. We want to be able
to change the gun, pitch and Yao with the gun, we can aim at the stuff
and shoot at them. Let's see how we can
do that. Next we
10. 09 modify gun bone: No, we need to be able
to rotate over gun so we can face over gun or aim
over gun at other things. So for doing that, we can
do it in mission blueprint. And how we can do it
with modify a bone. Which bone, let's just go here. In the skeleton, we
can open it like this. And in here, search for gun. And you can see we
have a gun joint. So with that, we can
bring it up and down. You can see. And we have
a turret joint as well. If you search for
turret, Turret joint. With the turret joint, we can rotate it left and right. So we have two bones gun
joint and turret joint. With the gun joint,
we look up and down, and with turret joint, we look left and right. For doing that,
there is a node in animation blueprint that
is called modified bone. So let's just make
some space like this and drag and drop from this
search for modified bone. The bone that you want
to modify is called gun joint for bring it
up and down, right. Next, we don't want to
change the translation, so we can tell it not
expose it as a pin. We don't want to change
the scale as well, so we can click in here, tell it not to expose it as pin. We want to just
change the rotation. So the rotation mode, we want to say add to existence. So if it has already
some rotation, it will have it after that. The rotation space, we want
to change it to bonus space. That's it. No, which one do we want to change
to look up and down? If you right click on here, split a stroke pin. The one that we want
to change is called pitch rotation around the
YXs we look up and down. If you put 45 in here
and head compile, you can see it facing up. That's cool, right? But I
don't want to do it like this, how I want to do it, I want to promote this to a variable. So right click on it,
promote to a variable. I want to call it
Gun pitch, right. And with that, we can go
to n in preview editor, and if you head compile, you can see the gun pitch there. We can change the
pitch off or gun. So let me change the size of this so you can see
it better like this. If I change something in here, you can see it's happening. The problem is it
can go like this. We don't want it to
happen like that. We want to limit it
to, for example, 30 degree and like this, right? No more than that,
minus seven and 30. So how we can do that, we can clamp it, right? So use clamp float, right? We want to clamp it between
minus seven and 30, right, and connect
these to the pitch. Now, if you head compile, save and change this value
to something really small, you can see it won't change. And if you change it to
something really big, it won't go more than 30
because this is clamping it. No, next thing, we want to be able to rotate
it left and right. And how we can do that, we can just copy and paste this node, contro control V to
paste it over here. We need to make
some space as well, like this and connect the execution pin like this
to here and here, right. And this time we want
to change the rotation around the Z axis for
looking left and right. So this rotation Z, but not for the gun joint. What we want to change
is turret joint. So search for turret
joint and put it there. Now, if we change
the ya, for example, to 45 degree again and headcpi
you can see it did rotate. Again, we don't want
to do it like this. We want to do it
with a variable. So right click in here,
promote to variable, and we can call it
gun. Ya, right? For looking left and right, know that if you had compiled, we can change it in here
and you can see it. Now we can rotate
or to it correctly. Everything looking good. The next thing that
we want to do, we want to calculate this
gun ya and gun pitch, and we will do it next.
11. 10 Calculate Gun rotation: Know what we want
to do. We want to calculate the gun
pitch and gun yeah, so with the camera and with
the mouse or controller, you can say controller. We want to change the gun pitch and gun ya, how we can do it. Let me run our game. You can see right now where
our camera is facing at. We can get this rotation
of the camera or the controller or the mouse and rotate the gun
with it as well. So how we can do that, we can go to event graph. First thing first, we need
to get this BP APC, right? So we can get the camera rotation or control
rotation, right? So in here, I want to
create a begin play. So with it, we can use the tri Git pawn owner and
cast it to cast to APC, right? We want to cast it to APC, so we can get the controller
off of it, right? For Make it easy, I want to right click in here, promote it to variable
and I want to call it BP APC, right? Now with that in each frame on this blueprint
update animation, we want to get APC. First of all, we want to
check if it is valid. Okay? If it is valid, we want to get the rotation of our controller or over mode
or over camera, right? For doing that, we can grab from this BP APC and get
the control rotation. This is the rotation that camera has or mouse
has or control has, or mouse is or
controller, right? Next, we want to get the rotation where
BPAPC already has, and how we can get that, we can get it by get
actor rotation, right? And now with these two, there is a node that is
called Delta rotator, right? With this Delta rotator, it will give us the
difference between the rotation that
our controller has and the rotation that we
APC has already, right? So let me connect this to
A and connect these to B. It will give us the
difference between them. And what we can do, we can
break this one, right, like this, break the
rotator, and that's it. This is the gun pitch, and this is the gun ya. And we can see it inside
these variables that we have. For example, gun pitch, you can set it with
this value, right. And we have Gun ya like this, set it with the yacht that we calculate from here and connect
the execution pin to it, so it will be
updated every frame. If it is valid, of course, you can see if you had compile save go to our
level and run our game no, you can see, I can look left, right, up and down. You can see we can shoot up
and down left and right. Know where APC is ready. We can spawn a projectile. You can see it.
That looks awesome. No next thing, we want to create a projectile so we can shoot it. Let's see how we
can do that. Next
12. 11 APC projectile: No, we want to create a
projectile for over APC. Let's see how we
can create that. For creating that, I want
to go to content drawer, go to Blueprint folder, and in here right create
a blueprint class. This time, a type of actor, and I want to call it BP
APC Project type, right? The I'll click on it to open it. In here, first and first, I want to add a
collision sphere. So search for collision, and we want to have sphere
collision. That's it. I want to make this as
default scene route. Next, I want to add
a sphere, right? Sphere like this as
a child of that. And the size of it, I want it to be 0.1 for
all direction like this. And the size of the
sphere, collision. I want it to be 16, right? That's it. The size of
this sphere is not enough. Let's just increase it
to 0.3 maybe, right? I think that looks much better. And I want to
change the material of this sphere for
the material of it, I want to go again in here, right click create a material, and I want to call
it red. Right? I'll click on it to open it. And in here with the base color, we can change the color. For example, if I click
in here, make it red, you can see it will be red, but I want to have
some glowiness. So that's why I hold tree on my keyboard, had
leftmost button. So it will create Constant
Tree Vctor or you can just right click Search for
Constant tree Vctor. With this, we can
choose a color. For example, the red, we want
it to be one. That's it. And we can connect
it to base color. No, we want to have
some emissive color, some light, right? For doing that, we can just connect these to emissive color. It will glow a little bit, but it is not a lot. We can just multiply this by really big value like 100 and connect it
to emissive color. And now you can see it's glowy. You can just save it, close it. Now, in APC projectile, we can change the material
of this to M red. Just search for it. Go down. You can see it over
here, and that's it. This is our projectile,
and it looks good. Next thing that we want to do, we want to add the
projectile movement, right. With this projectile movement, we can have initial speeds. So for example, 8,000
and Max's speed 8,000. And next I want to make
it bouncy, as well. So it will bounce a little bit. Of course, destroy it
this won't bounce, but at some cases, this looks more natural. If you go down, we
can have a velocity. I want to put 3,000
in x direction. That's it. No,
let's just say so. If you go toward the X direction, you
can see it over here. If you had simulate, no, you can see it is going
away. That looks awesome. Next thing that I want to do, I want to click on
this sphere collision and set its collision. If you go here, I want
to change this collision preset to custom and let's just expand this
so we can change it. The thing that I want to change is to block the physics body. And block the destructib, right? Next thing, I want to tell it to ignore the pawn as
well, and that's it. That is the collision for
over a sphere collision. No, click on the sphere
tatic machine here. For the collision of it, I want to tell it to
don't have any collision. So put it on no
collision, and that's it. Let's just test
it one more time. If we had simulate, you can
see, it's working fine. No, in next video, we want
to fire up the projectile. Let's see how we
can do that with leftmost button in next video.
13. 12 Fire weapon: Now we have a projectile. Let's see how we can use it. For using it, first,
we need an input. So let's just go to
Inputs folder in here. Rightly, go to input and
create a input action. I want to call it
IA Fire, right? And we don't need to
change anything inside it. We can go to IMCAPC
to map it there. So add a new map in here and
select the IA five, right? When do we want it to happen? Let's just click in here
and hit if Most button. So if Most button, put it there, right? So know whenever we hit if Most button, this
event will happen. So right click in here and
search for IA fire, right. And with that, let's
just expand this. Whenever we press it, we want to spawn or projectile. So use span actor. And the actor that
you want to spawn, it has projectile inside it. So let's just search
for projectile, BP APC projectile, put it there. No, we should tell
it where to pawn it. We want to spawn it at
the tip of our gun. So in here in the skeleton, if we search for gun, you can see, there is
a gun joint socket, a tip of our gun.
You can see it. That looks awesome. We can
just right click on it, rename it, and again, right click on it and
copy its name, right? The name is important. Now, with that, we want to get the transform of that socket. How we can do it, we can
get our mesh, and with it, we can get the socket transform. So get the socket transformed. I need socket name. So Control V to paste that gun joint socket and
connect it like this, right? That looks awesome. Now, with that, let's
just head compile, save, go to our level
and run over game. Now, you can see, I
can shoot it, right? You can see that looks awesome. We need to add some
sound as well. So let's just go to BP APC. After we spawn this, we can spawn sound
at location, right? The sound that you want
to spawn is called S cannon fire single,
right? That's it. I need a location. So we
can break this transform at tipo over gun and use its
location for the sound. Now, let's just compile, save, and run over game again. Now, if we shoot, you can see, we have some sound as well. Next thing that we want
to do we want to spawn a system A Niagara system
this time attached, right? The Niagara system that
we want to spawn is called main cannon N
is main cannon, right? I need to attach to a component, so we can attach it
to the mesh, right? And the attach point name, we can just use
this socket name, Control C to copy it and paste it for the
attach point name. We want to attach it
there. For the location, we can get this location
of tip of Ogun, and for the rotation, again, we can use the rotation
of the tip of Ogun. Now, the location type, I want to change it to keep
word position, and that's it. Let's just compile, go to
our level and run over game. Now, let's just shoot. You see? It has some visual
effects as well. You see? That looks awesome. We
have some visual effects. Cool. Now with that done, we have a projectile, but we don't have
nothing to shoot at. We should have some object, so we can shoot at it and
move it a little bit right. Let's see what we
can do that. Next
14. 13 Hit physics body: Now that we are
firing over weapon, let's see how we can
hit something actually. For doing that, this
is our players start. I want to add a sphere
in here, right? Click on Add, go to shapes
and add a sphere, right? And I want to make this
sphere a little bit bigger. So make sure this is lock
and put five in there, for example, so it is a
little bit big, right? I think it is too big. Let's just put it on three. Yeah, that's good. Now, in here, I want to go down and tell it
to simulate physics, right. After that, go down and make sure this is
physics actor, right? So we can hit it. No, let's just run or
game. No, you can see. When we hit it, the
projectile is bouncing. You see, we hit it, and it is bouncing. But one problem that we
have when we hit it, it's not moving at all, right? You can see it's
not moving at all. Let's just go a little bit
back and hit it. You can see. It will bounce on it. That looks awesome,
but it's not moving. How we can make it move. If we go to our projectile, go to event graph. And in here, I want
to right click and search for event hit. Right? This seventh head will happen whenever we
hit something, right? So let's just test it with the print testing,
and that's it, head compile and
no let's just run it to see if it's
detecting the head. Now you can see it detecting
the head. That's cool. No, we can just delete that. First thing first, whenever
it hits something, it can create
multiple head events. So that's why I want
to use due once. So whenever it hits something, if it is giving us multiple head just one of
them will happen, right? This complete will happen
just once until we reset it, right? We don't
want to reset it. Whenever it hits something, we want to spawn some explosion, add some force, and all of that. So it can move the
sphere, right? First thing that we
want to check in here, we want to check the
other component to see if it is simulating
physics or not. If it is simulating physics, add impulse to it, add some force to
it, so it will move. So in here, we check
Es simulating physics, right with it, we can check it with a branch.
Search for branch. If this simulating physics, this true will happen, right? In that case, we can add
a impulse at location. So search for add impulse at location,
choose one of these. You can just let this
sphere. We don't need it. Just search for
addimpulse at location. The target that you
want to add impulse at location is this
other component, right? So connect the other
component to it. Know it need impulse, how we can get impulse. Because if we hit it this side, we want to add impulse
on this side as well. So it will go that way, right? So for doing that, we
can get the velocity, get the velocity
of our projectile, we get lost node. We can multiply it by some value because by its own,
it's not too much. We can just right click in
here, change it to float. So we multiply X, Y, and Z at the same
time, for example, by 100, and this is our impulse. But on what location we
want to add this impulse. We can get the location of or projectile when it
hits something. It is the location that we
want to add impulse, right? So we can just say
get actor location. Right, then that's it. No, it will add some impulse, some force to our sphere. Now, let's just say state. Now, if you shoot
it, you can see it's moving toward the way that
we shoot at it, right? Again, if we go this
way and shoot at it, you can see it's moving that
way and you can see it. It's working fine. And we
have some bouncing as well. We don't want that bouncing, but as you can see, it's working fine. Let's
just go to it. If we can reach it, right, let's just go to it like this, we can push it as well, right? So, no, we are close to it because there
is not a lot of friction. That's why it's moving too fast. If we shoot it, you can see, we make it a stop and we can shoot it again to
move it around. You can see how beautiful
it looks. That's it. We have a projectile that
can move physics body. Cool. Now it's time to create some destructible object.
Let's see how we can do that. Next
15. 14 Import destruction files: No, we have a sphere
in our scene that we can push it with
the projectile, right? It has physics enable on it, but we can't destroy it. We can't take it apart
with a projectile, right? From now on, we want
to talk about how we can take apart things,
destroy things. First, I will teach
you the basic stuff, and after that, we go for
creating a building, right? For doing that,
there is a zip file a description of this video
that is called destruction. Download it, put it
on your desktop. You can just do click on it, dragon drop the destruction
folder into the desktop, and know with this folder, there should be assets
folder inside it. That's it. Now, go to
ARIEL Engine Project, go to Content drawer, right click on Content folder, and in here show it in Explorer. In the content folder, the destruction folder
should be there. So dragon drop it, put it there. Now, if you go back
to ARL Engine, you can see that there
is a destruction folder. You won't see
anything inside it, so you need to close Areal
engine and open it again. So let's just go back in here
and open up the project. Now, with that, if you
go to content drawer, you can in destruction folder, in asset folder,
there are some stuff, for example, some aesthetic
mesh for the building, right? If I go into meshes of interior, for example, you can see it. If I go to L one for level one, you can see there
are some glasses, some concrete, and you
can see it, right? With this, we want to
create a building, right? And if you go back
to *** folder, there is a fields
folder as well. There are three
blueprint in here. This Tre blueprint is published
by Al Engine developers. It actually in the
engine itself, but I did copy it here, so you don't need to go to engine folders because it's too confusing if you go there. So with these fields that Areo engine developer
created for us, we want to create explosion, for example, and take
apart things, right? So that's it. All the
necessary stuff is here. It's no time to be able to
take apart this sphere.
16. 15 Fracture sphere: No with everything important, let's see how we can destroy
or take apart this sphere, click on the sphere and go here, change from selection
mode to fracture mode. With Shift plus six, you can go to fracture mode
and with Shift plus one, you can go to selection mode. Go to fracture mode. And in here, first thing
that we should do, we should create a
geometry collection off of this sphere. The geometry collection is
the collection of the parts of this sphere when it is destroyed and it
did take apart, right? So for doing that, click on NU, and it will tell you,
Where do you want to save this
geometry collection? I want to go into destruction. And in here, right, click on the destruction folder, create a new folder,
and I want to call it GC for geometry collection. And inside it again, I
want to right click, create a new folder and I
want to call it basics, why I'm calling it basics, because creating a building that is destructible
is really complex. So that's why I want to teach the basic stuff
with this sphere, and after that, we go
and create our building. So it's really important
that you learn this, right? So save it in basics. You don't need to
change anything, just click on Create
Geometry collection, right? Now, you can see if we go back to selection mode,
what will happen. Color of it is changed, and our sphere is replaced
by GC sphere, right? And what is this GC sphere? If you go to disruption folder, go to GC Basics, you can see there
is a GC sphere, geometry collection
sphere in here, right? We can just drag and drop it, put it wherever we want, right? If you hover over
it, it will say, GCSphereGeometry
collection, right? So, no, we did create
our geometry collection. But if we bring it up, for example, in
here and head run, you can see it is
hitting the ground, but it's not destroy it. Why it's not happening. Again, if you click on it, and go to fracture
mode like this. In the level statistics, you can see there
are just one level, and this level have
just one bone. That's why it can't
be destroyed. How we can make it destroy, we can go to fracture
category in here. Maybe for you, this
is like this, right? That's why I didn't
make it bigger, so we have more space in here and we can see
everything, right? So click on uniform. I want to fracture it uniformly. You can see, no, there
are some lines that tell you how it will be
fractured, right? So you can change some
stuff, for example, minimum sites and
maximum sites, right? If you go down, there is lots of things for randomizing stuff, but I don't want to
change anything. You can actually change
lots of things in here. And when you increase
these values it will drop your frame per
second, FPS, your optimization. So I don't recommend it
to make it really high. So just with that, if we hit fracture, it will fracture it for us. And you can see in level one, we have 19 part. For just testing it, there is explode amount
that is value 0-1. And if you change this, you
can see how it is fractured. You can see this way
it will be fractured. And for you to test it actually, you can run the game and you can see when
it hit the ground, it will be fractured. The problem right now is
that the color of it, right? So if you change
the explode amount, you can see the colors of it. We don't want it to
be like that, right? For fixing it, so it will
have a color of sphere, not this randomized color for each bone or each
cluster, right? We can go to detail
panel and in here, go down in general, inside the chaos physics, we can tell it don't
show bone color. That's it. Know with that done, if you go back to
selection mode, you can see the color
of a sphere is back. And if you run over game, when it hit the ground, you
can see it will be fractured. That's beautiful,
right? No, again, I want to go to fracture mode and change this explode
amount to zero. So in the viewport, we can see it correctly. And after that, go back
to selection mode again. If you put it on the
ground, let's see. I don't want it
to be exploded by its own so let's
just run over game. Again, it did explode
because it hit the ground. Go down a little bit, run no, you can see
it didn't explode. And if we hit it by our car, you can see we did make it explode or destroy,
you can see it. That looks really cool. No, next thing that I want to
talk about is the material. The material for outside
of this sphere and material inside for the
inside part of it, right? So let's see how we
can do that. Next
17. 16 Fracture material: No, for changing the material of outside of it inside of it, again, we need to go
to the fracture mode. So click on it, go to selection mode and change
it to fracture mode, right? And in here, there is
a part that is called. If you go down that is called
material in utilities, right, click on it. And for you to see it properly, I want to make this smaller like this and you can
see it over here. No, right now, if you go to asset materials in
asset material in here, there is basic shape material. Let's just change it to red, the one that we create
before, this red one. Now, what will happen. If you go to selection
mode and Runo game, you can see the outside
of it is glowy red. But if you hit it, let's see what will happen
to inside of it. You can see the inside of it has the outside
material as well. What we want to do we want to
change the inside material. So for doing that, we
need some material. What I want to do,
I want to go to the GC Basics folder and
create some material. So right clicking here,
create a material. This one, I want to call it red. Okay? I don't want
it to glow at all. And again, create another one. This one, I want to
call it blue, right? For the red, in here, we can just change
the base color to red, so it will be red. I'll click on the base color. And for the red, I want
to put red to one, green to zero, blue to
zero, and that's it. We will have a red
color, right, easy. Now, we can just
head save and head, yes, so it will be saved. You can see it. Now,
let's just go to blue. You can do this yourself. Click on base color, change the red to zero, green to zero, and blue to one, and it will give
us a blue color. Make sure you save it before
closing it, and that's it. We have two material
that we can use it for outside and inside
of our sphere. So now, click on the sphere, go to fracture mode for
you to see it better. The explode amount, I
want to put it on one, so it will be like this, right? Now, go to material down here. Right now, again, the amount of material that we have
is just one index zero. And if we change it
to, for example, blue, outside and
inside it will be blue. It changed to none. So again, selected to blue,
and it will be there. Now, you can see the outside
and inside of it is blue. But we know that we should
have multiple slot, one for outside and
one for inside, right? No, there is just one for
outside and inside both. So for adding more slot, you can just click on
add material slot, and now you can see we have
two slot in here, right? So for the slot zero, we want to use it for
outside material. And for the slot one, I want to change it to red. Let's go down if I can find
that search for red and red. So I want to use this slot
for the inside material, this inside part, not
the outside part, right? So if we just hit assigned
material, nothing happens. If you go to selection
mode and you can see, again, all of it is blue. Let's just go back
to fracture again. How we can change the inside
to red, how we can do it. We did at this slot there. There is assigned
material in here. So we want to tell it to inside material will
be red. How we can do it. You can see first the
assigned material, we have zero and one, you can see zero and one. One is red. So make sure you go to
fracture hierarchy, and in this hierarchy in here, select all the fracture
porch 0-18, right? Sphere zero. If you
click on this first one, it is level one,
that whole sphere. And if you click on
this inside one, you can see how it
is selected in here. We need to select all
of these inside porch. Okay? And after that, go to assign material, choose the material one to be paint on the face
of internal faces. So click on internal
face, hit assign. No, it did change. For you to see it better, let's just go back
to selection mode. Now, you can see the
inside of it is okay. If you run over game, you can see a
default, it is blue. If you hit it, the inside of
it will be red. That's it. So again, make sure if
you go to fracture mode, make sure first you
select the parts that you want to change the
material inside of it, right? Go down, go to material, create the materials
that you want. After that, assign the
material, for example, index one that is red to internal faces of
these parts. That's
18. 17 Damage threshhold: No, we have a sphere
that is dsructible, but I want to show you
some more options on it. So for doing that,
let's just first change this explode amount to zero so we can see
it, actually, right. After that, go back
to selection mode. You can see this is or a sphere. And if we go to detail panel when we select it
and we go down, there is a damage category inside the chaos physics, right? So go down. In this
damage category, if we expand this
damage threshold, you can see the amount of force or damage we should
employ to this one, so it will break. The index zero, Index one, index two, and you
can have more, right? Let me again go back
to fracture mode. You can see we have level zero, level one, and so on. And we have it for
the damage as well. Level zero, level one, level two, you can
have multiple, right? By this much, the number
that we add in here, it will be destroyed
if we had it, right? If I hold control, I can create a duplicate off of it and change this value
to see the effect. I want to divide all
of this by four. Okay? It will
calculate it for us. Divide this by four and divide this by four
as well, right? Now, if you run over game, you can see when we hit this
one, it will be destroyed. It will take apart, right? But if you hit this one, you can see it needs less force to be destroyed,
right? That's cool. Again, let's just duplicate
it one more time. Hold all, duplicate we
drag and drop like this. And again, I want to go
to damage and again, divide it by four. This one divide by four as well, and this one divide
by four as well. No, this needs less
force to be destroyed. Let's just hit it. Just go to
it and hit it. You can see. Of course, it The amount of disruption won't change
because in the fracture, we decide how it should
be, but as you can see, the amount of force to destroy this one was
less than this one, and this one was
less than this one. You can see I did hit this, but none all of the parts
is taken apart, right? Again, I want to
click on this one and duplicate it one
more time over here. And this time, I want
to multiply it by four. All of these damage
thresholds multiply by four. Let's see what will
happen. Multiply this by four and multiply this by four. And now, if you run over game and hit it with our car,
let's see what will happen. You can see we are moving it, but it's not getting destroyed. Let's just go back and
really hit it much faster. I don't think that
anything can happen to it. And that you can see, I did hit it really hard and it get destroyed
a little bit. No, let's just again
duplicate it one more time. This time, again, multiply
it by four again. This time, we won't be
able to destroy it at all. I don't think that
we can do that, multiply by four and multiply
this one by four as well. And no with that, let's
just run over a game. Let's just go back and hit it, just like this and you can see it won't be
destroyed at all. Go back at the space so we
can have a handbrake as well, and let's just hit it. Again, you can see we are
hitting it really hard, but nothing is
happening to it because the damage threshold
is much higher. Let's just go here
and hit this one. You can see the damage
threshold of this one is high, but because we hit
it really hard, it did destroy little. This one is much
easier to destroy. And again, this one is
really easy to destroy. Just heat it a little bit. It will be destroyed, right? That set about damage threshold.
19. 18 Damage with Projectile: No, we have some sphere that we can make it destroy, right? But the problem is
with our projectile, we can't destroy it.
Let's just test. Run or game, shoot at this one, you can see, I'm shooting it. Nothing is happening. Again, this one, again, you can see. Nothing is happening
to it, right? So we need to find a way so we can apply some force so we
can destroy these ones. Right now, it is hitting it. It will add the impulse to it, but the impulse is not
enough to destroy it. For doing that, our
engine developers create some blueprint for us to add some force
to whatever we hit. And that's inside
where let me show it to you in fields in
destruction, assets fields. There is FS field. This is for applying
some destructible force, for example, explosion
force, right? So no, we need to use that. For using that, I want
to open up a projectile, go to APC folder, go to Blueprint and open up
the APC projectile, right? And in here, after we add
a impulse at location, we want to spawn this force. Spawn actor from a class, the actor that you want
to spawn is called FS. You can see FS field. That's it. Just choose that. I
need a transform. For the transform, we need just the location when this projectile hit
anything, right? So we can break this it result. Let me bring it over
here and break it. And this will give us
an impact point, right? We can use that impact point
to make a transform, right? Make a transform with
that impact point. And this is our Transform. We could just get
actual transform, but this is more than enough and it's more precise, right? That's it. Next, this FS field needs to be triggered, right? We can decide when
to be triggered. We want to trigger it whenever
we spawn it really fast. There is a function inside
it that is called C trigger, right? C trigger, right? This will trigger the force. Let's just test
it with this one. If we run over game
and shoot at this one, you can see it did add force
to it and destroy it, right? Again, shoot at this one. You can see destroy
it, shoot at this one. Again, it's destroying it. And shoot at this one,
again, it is destroying it. And you can see how
beautiful it works, right? No, let's just add more
damage threshold, right? So hold out, create another
one, and again, this one, multiply it again
by four like this, multiply this one by four. And multiply this
one by four as well. And I want to add another one. And again, this one, I want
to multiply it by four again, right? Multiply by four. This one be multiply
by four again, and this one multiply
by four again. If we run over a game and shoot at those one, you can see, it's like the force is so much that it doesn't matter what
damage threshold it has, it will be destroyed, right? What is the reason?
20. 19 Change power of explosion: No one big problem
that we have in our level is that it doesn't matter which one
we shoot. You see? I'm shooting this that
the damage threshold of it is too much. And this one, that
the damage threshold of it is a lot less. It will be destroyed, right? We don't want that to happen. Why it's happening, it's because this FS field is really powerful.
We need to change that. For changing that, we can get this return value
of our FS field, right, and set the
strain magnitude in it. Set a strain magnitude, right? Connect the execution pin to it. After we set it, we can connect it to see trigger
to trigger it, right? So for example, if I put 5,000. Let's see
what will happen. If you run over game, shoot at this one,
nothing is happening. Shoot at this one, nothing
is happening again. Shoot at this one,
nothing is happening. Again, let's just increase
that by 50,000, right? 50,000. Now with that. With this 50,000, if
you run over game, shoot at this one, it will
be destroyed this time. If I shoot at this one, it won't be destroyed. If I shoot at this one, nothing is happening to it, right? So again, if we increase
this value by another zero, and if we run again,
shoot at this one. It will be destroyed, shoot at this one, it
will be destroyed. Shoot at this one, it
will be destroyed. Shoot at this one.
No, you can see. This one is resisting. So again, if we add
more zero to it, one more zero, if
you run over again, this one will be destroyed. This one will be destroyed. This one won't be destroyed. Again, we can increase this. So with it, we can decide how much force explosion force it should be happening
to that sphere, right? Now, you can see some of these sphere
we can destroy because the damage threshold
of them is not a lot, but some of them
we can't destroy. No, you know how you can play with this explosion
force FS field.
21. 20 Size of clusters: Another thing that
I want to talk about is the size
of this sphere. So for example, let
me run over game. You can see with the force power that we have a strain
magnitude that we have, we can destroy this one,
this middle one, right? Now, let's just duplicate it. Hold old and duplicate it, bring it over here, and again, it will be
destroyed, right? Let me shoot at it. I can. You can see it can be destroyed. But if I change the
size like these two really big and bring
it up a little bit, No, if we run over game, you can see if I shoot at it, nothing is happening, right? Because the size of the clusters or those
parts, it's too much. And that's why the force that we have, it
won't affect it. So the size of the
clusters or those parts, those broken parts
is really important. If we shoot at it really a lot, it will be destroyed eventually, but it won't happen fast you can see if you add
lots of force to it, eventually it will be destroyed. You can see it,
right? So the size of the geometry collection
really matter. If it is big and the damage
threshold is less, again, if we resist these fields
that we apply to it. You see, it will be destroyed, but it takes too much effort
to destroy it, right? That was it. That was another thing that I
wanted to talk about. The size of the geometry
collections does matter.
22. 21 Explostion VFX: No next thing that
I want to do I want to add some effects
to our projectile. Right now, you can see when I shoot at something,
it will be destroyed. Cool, right. But there is no visual effects
when we hit it, right? So for doing that, I want
to go to our projectile. After we trigger this field, what I want to do
I want to spawn a spawn system or Niagara
system at location, right? And the system that you want to spawn is called Ordinance. I, right? For the location, I can just get the
actor location. Right? Get actor location
is more than enough. The location of our projectile when this event hit happen, when this event hit happen, it will give us the
location of our projectile, right, and we want to
have explosion there. After that, we want to
spawn some sound as well. So expan sound at
location as well, the sound that you want to spawn is called great explosion. The location of it, again, we can just use this
location there. And after that,
after all of this, we want to destroy this
projectile because it has its effect on our level
already, so we can destroy it. We don't want it to bounce. Now, if you run over game
and shoot at something, you can see, there will
be explosion there. That looks much more awesome. You can see how beautiful it is. Right? No. One problem
that sometimes I see, this explosion won't happen always, and that is a problem. Why sometimes it's not
happening Because in here, we check if the object that we hit is simulating
physics or not. And if it is simulating physics, we add impulse at
location, right? But we want to do
it in both cases. We want to do the
field in both cases. We want to do the explosion, even if the actor that we are hitting is
not simulating physics. Just with that, if
you had co point, nothing is changed, but we will prevent
some bugs with it. We shoot, again, it
works like before, and everything look good. I just that one. You can
see we are hitting it no hop. It a lot. So it should be
destroyed, right? And we did destroy it, right? Again, this one,
we are hitting it, nothing is happening
to it because the damage threhol is too much. Let's just hit that one. And now you can see,
everything is working fine.
23. 22 Ancher fields: No next thing that I want to
show you is anchor field. So let me explain. Sometimes some part
of these spheres, we wanted to keep intact, right? So we can stack them
up of each other, right, put them on each other. So right now, if you shoot it, all part will collapse, right? So for making some part of this resistance
to the explosion, let's see how we can do that. There is another field in our fields folder that
is called anchor field. And we can just
drag and drop it, put it on or level
and make it bigger. So wherever it is included, it won't be destroyed. So like this, we
are making it big, position it at the middle, for example, in here. So no, each cluster part
that is inside this box, it won't be destroyed. But just by its
own, it won't work. We should tell this
geometry collection that this is your anchor point. You should be anchored
to this box, right? So for doing that,
we should click on our geometry collection. Go to GC or Geometry
Collection tab. And in here, you can see
there is initialized field. We can add fields to it. For example, anchor field, right? Click on add. We should decide which anchor
field we want to add it to. Either we can just click in here and choose the anchor
field or we can just click on this peak actor from a scene like this
and choose it there. Now, you can see it is there. And no let me put this
really at middle like this. Now, this part will
be destroyable and this part won't be
destroyable. Let's just see. If we go to this part
and shoot at it, you can see this
part is destroying, but the other parts that is inside that anchor fields
not getting destroyed. We should shoot at a lot
to make it destroyed. You see? We should
shoot at a lot. But it is persistence.
You can see. Again, it's not falling off because there
is an anchor point. You should shoot it a lot, so the anchor point will leave the clusters, right? That's it. This is the anchor field. And with the anchor field, we can do a lot of things. If I select both of
these and bring them up, now, if you run over
game, you can see, because it is anchored to that anchor point
and anchor point doesn't have any physics, it won't be able to go down. We can shoot at it, and the part that is
destroying will fall off. But because there is an anchor
point, it will stay there. The rest will stay
there. You see? We should shoot it a lot so
we can destroy everything. Cool, shoot them and you can see and there is a part there that is stained
there. That's it. Why we want to use it, let's say we have a building and these buildings
have some columns. These columns should be more persistent to the
damage to the field, so it won't be
destroyed really easy. So that's why we
need anchor point because in each building, we have some columns that make
our building more stable, more powerful to the
winds and all of that.
24. 23 Attach two Geometry collection Part01: No, let me give you
another example. For example, this one, I want to duplicate this anchor field, hold out, duplicate it, and put it for this one, right? This does have lots
of damage threshold. Let's just bring the
top as well, like this. And first thing
first, as you know, we should click on our
geometry collection and add the anchor
field to it, right? So click in here, choose
the anchor field, so it will be added there. Now, again, if you run, you can see if you shoot it, just this part will
be destroyed easy. But the part that it
has anchor field on it, it won't be destroyed at all this time because the
damaged threshold is too much. You see, everything looks good. You see the parts that is inside the anchor field
is not destroyed. Let's just shoot
at it and see take too much shooting
to destroy that. Another thing that I
want to test in here, I want to create one of these, for example, this one,
put it over here. You know that the threshold of this one damage
threshold is a lot less, so we can destroy it
really easy. Can see? No, what I want to do I want
to create a box in here, so we put this sphere
on top of that, right? And we want to anchor
this sphere to that box. Let's see what we can
do that. Go to A, go to shapes and create, for example, a cube, right? In here, I want to make
this cube bigger like this and like this and in Z direction
bigger like this, right? And I want to bring
it down like this, and I want to put this at top of this box or column, right? Let's just put it there. Go here and put it like this
top a little bit. Now with that done. If you run over game, let's
see what will happen. It is a stay there, right? But this column, you shoot it, let's just see what will happen. Nothing is happening
to it, right? So first thing first,
with this column, what I want to do I want
to go to collisions and change the collision presets
to physics actor, right? Now, if you run over game, let's just look at
it. You can see? No, we can't get it. No next
thing that I want to do. I want to go to physics and tell it to simulate
physics. That's it. No let's run or game. And you can see, because we
are simulating physics, no, you can see at top of this box, the sphere is getting destroyed. Let me bring this
sphere a little bit up like this to see
if it gets destroyed. No, this time it is okay. No. After some time
because this is a physics body is
touching this sphere, that's why it's
getting destroyed. That's not what we
want. We are putting an sphere on a column, and it should stay there. Why it should be destroyed? How we can prevent that?
25. 23 Attach two Geometry collection Part02: First of all, let's create a geometry collection
off of this column. So click on it, go to fracture mode, and in here, create a
new, go to destruction, save it in the GC basics, right, and call it GC cube, Head create geometry
collection, and we have it. I want to make it uniform.
So click in here. You don't need to
change anything. Head fracture and it will
be fractured, right. Now with that, again, we need to go to material. I want to change the material. So select all of these
clusters, right? We want to add another
material slot. This one, I want to
put it red as well. The internal, I
want it to be red. So let's just put red there, or let's just choose
that glory red, right? This time, e red, right? The glory one. Now, with all of this selected, we want to tell it to index one to apply to the faces
of internal faces head, apply assign, and know if we
change this and go close. Let's see if it's
affecting it or not, it a sign again. We go to selection, and in here, don't
show bone color. You can see the internal
or red. That's it. Now, let's just again go back to fracture and change this
explodamun to zero. Now, again, let's just
go back to selection. If we run over again, none of them is
destroying because both of them are
geometry collection. If you shoot one of them, you can see it will
destroy both of them. If you bring this up a little
bit and run over a game, let's see what will happen. Both of them are destroying. But let me bring it
a little bit closer. A little bit of touch. You can see a little
bit of touch. With gravity, it can
destroy both of them. You can see let me rotate these players start so you can see it as a start like this, Runo game, can see
it is destroyed. So know how we want to fix that. We can use anchor fields, right? So let's just add anchor field. Just rag and drop
anchor field in here. We want to make it
bigger this way, and we want to make it bigger this way as well, like this. Move it so it will
be at the middle. Just play with it until you reach the result
that you want. Bring it a little bit to this part, and I
think that's good. Now, we want to make
it bigger on this way, bring it up, and that's it. Now we have an
anchor point, right? With this anchor point, we need to tell the sphere to add this anchor field as
your own anchor field. So click on the Sphere
Geometry collection. Click on AD, click
on this color picker and choose the anchor point
that we create, right? Again, click on
this cube, right, make sure you select
it over here, add the anchor point
to this cube as well. So click on AD and add the
anchor point to that as well. Now, if you run over game, you can see it will stay there. It won't be destroyed.
If you shoot it, you can see it will destroy, but it won't collapse. You can see it won't collapse. And if we hit top
part of this sphere, let's see if we do that, can see it will be destroyed, but it will stay
there after that. You can see, next thing
that we want to do, we want to be able to collapse this cube or column
whenever we shoot it. You see, we are shooting it, and there is no ground
to be based on, you can see it is in the sky. So we need to find a way to
destroy this anchor field whenever we hit the column at the beneath over
a sphere, right? But so we can do that next
26. 24 Destroy ancher filed: No next thing that we want
to do we want to be able to destroy this anchor field.
You can see it over here. If we hit this anchor
field or hit close to it, right, because it
is a explosion. It should collapse the column and the sphere above it, right? So for doing that, we need
to go to the projectile. And in here, before
destroying this actor, what we want to do we
want to check if there is a anchor field close to
the explosion, right? So for doing that, I want
to use a sphere trace, multi sphere trace by channel. And for you to see it better, I want to enable the draw
debuc type for duration. And by default, the
duration is 5 seconds, it's more than enough, right? They start an end point. I want it to be get
actor location. So get the actor location. Where they explode is happening, it'll be the actor location
because they explode is happening at the event hit
whenever it hits something, or projectile hits something. So no, they start an end. We can just put it as a actor location when it
hits something, right? The radius, you should decide what is the radius
of this explosion. For, no, I want
to put it on 500, but you should play with that until you reach the
result that you want. With that, let's just
compile and run over game. If we shoot to column,
if I can, of course. And you can see, no, there is a sphere there
that with that sphere, if there is an anchor
field inside that sphere, we want to destroy it. How we can destroy it. The multi sphere trace
by channel give us all the actor that is inside this sphere that we
saw together, right? So what I want to do in here, I want to use for each loop, use this for each
loop like this, connect the execution pint it. And every element that
is inside this sphere, we can break this array element. That is just a heat result. Break it first, and the actors that are heating will
be this head actor. I want to cast
this head actor to FS anchor field generic, right? If it is anchor field, in that case, we
want to destroy it. But how we want to destroy it. We don't want to just
say destroy on it. How we want to destroy it? If we go to Content Draw, there is FS destroy
anchor field as well. This will create
another field that will destroy the anchor field, so it looks more natural, right? So for doing that, I want to use a spawn actor from a class. And this time, I want to use destroy FS destroy
anchor field, right? And after that, we can destroy
the projectile as well. This needs a span transform. We can get the transform of this anchor field that
you want to destroy. So get Actor transform, right? And with this, we can just connect it to
a span transform. The transform have the location, rotation and scale as well. And this is really
important, right? And with it, we need
to trigger it as well. L over FS field, if you remember, in here, whenever we spawn FS field, after that, we
trigger it, right? In this case, we want to trigger this as well to
destroy it, right? You can have some
delay in here as well. So after 1 second,
destroy it, right? But I want to say S
trigger right after that. Se trigger, it will destroy
anchor field, right? And the anchor field will
be destroyed right away. Now, if you run over game, let's just get close
to it and shoot at it. We shoot. You can see
it will be destroyed. That looks awesome. But
what I want to do I want to disable this draw debye because we can't
see it correctly. Let's just run again
if we shoot at it. You can see, it
will be destroyed and it looks more
natural, right? Again, we can do it
with others as well. For example, this one, let
me go a little bit away. If we shoot at this
one, you can see, both of them are
destroyed because the explode radius
is too much, right? We can just decrease this
by 200, for example, and know if you run a game
and shoot at this one, let me see can see it will be destroyed
and it will go down. If we shoot at this one, again, it will be destroyed
and it will go down. And again, if we
shoot at this one, and now you can see, we are destroying two
geometry collection with one head because one of them is a top of another one. Now you know all the basics, but the buildings
will be more complex. So make sure you understand
all of these basics. Let's see how we can create a building geometry collection
that can be destroyed.
27. 25 3D files Folders: Know that we learn the basics, it's time to create our
building, destructible building. For doing that, first, let's just look at
the estatic meshes. If we go to content drawer, go to Assets folder in
the destruction folder, go to aesthetic meshes. We have a buildings folder. After that, building SFG and
after that go to meshes, you can see we have interior
and we have L one, right? And here we have
some stuff, right? Let me show it to you. This is a brilliant way to export
three D files, right? So why it is a brilliant
way to import the stuff, it's because you can
see we have building SFG base column corner.
Just select that. After that, we have building
SFG one wall column corner. Select both of them withholding control and just drag and drop. Now, you can see,
both of them are at top of each other
really perfectly. We don't need to
move them, right? So these two needs
to be in one folder, so it will be easy
to work with, right? So right clicking here, create a new folder, and I want to call
it corner wall. And this one and this one, we can just drag and drop it, put it there, right? So if we need a corner wall, we can just drag and drop
these two and put them there. You can see how beautiful it is. Now, let's just organize
the other ones. This is the best way to
get the files in three D, so you can create your
modular building, right? Again, we have a
column meat, right? And if we hover over this one, it's called column
mid at, right? Select both of them, drag them in here and
know you can see, they are perfect
together, right? You don't need to
position them at all. And this one on the right
click, create a new folder. This one, I want to
call it middle wall. These two, we want
to put it there. Move it there. Not the rest. Let me show you something. Just select all of these files without these
folders, dry and drop. Now you can see all
of them is creating middle window with everything and everything is
set up correctly. If they weren't like this, it will be really hard
to work with this stuff. No I want to put all of
this inside another folder, right click in here,
create a new folder. Middle win dough, right? Set. We can select everything. Deselect this one with
holding Control and drag and drop all of
them in here, right? So with this modular design, we can create a
building real easy. Let me delete this one. I don't want to do it like this. I just wanted to show
you how you should get your three D files from your
three D artist designer. This way is much easier. So for example, we can go here, select the two, and drag and
drop it, put it over here. Make sure you click in here
and surface snapping is on. It will be easier to
work with it like this. No, next thing, for example, we want add a window, right? So in the middle window,
select everything, right and you up,
and you need to just put it in here
once, right, like this. Of course, it's not okay. I will show you a
better way to do this. But for now, you get
the idea, right? You can see. No, we did
create some part of it. We can just change
some stuff like this, bring it inside a little bit. I need to go left a little bit, like this and bring it down. And, yeah, that's how
it should be, right? So with it, we can create
a modular building. Again, I want to delete that. I just wanted to demonstrate
how we want to create it. This way of getting the
three device is the best.
28. 26 Fracture corner wall: No, first thing that we want
to do we want to create a geometry collection of all of the things
that we have in here. For example, let's just
start with corner wall. And in here, just
select both of these, drag and EuropetPut
it on and select, for example, this base one, go to fracture mode. And in here, first of all, we should click on New. And after that, where
we want to put it, we want to put it in GC. And inside this GC, I want to create a new folder. I want to call it corner wall. Okay, or whatever
you want to call it, he create geometry. And after that, you can do whatever of this
one that you want. I recommend uniform because
it's more optimized, but the closer v
looks more beautiful, and you can see how it
will fracture it, right? This much of
fracturing is a lot. So what we can do, we can decrease this
value, for example, for this one to ten maybe, and you can see, no, it
is less to five maybe. And let's just see
what will happen. Head fracture and 27 for
this small part is a lot. I don't want it to be like that. So I want to show you how
you can reset it, right? Right now, it is
fracture to level one. I want to click on Reset, and with it, head rest
and it will be reset. You can see there is
no level one anymore. Again, go back to cluster. The amount of sit per cluster, I want to change it two by two, head fracture, and
now you can see there is 18 of them. Again,
it's too much. We can change the minimum
number of cluster, and maximum number
of cluster as well. Again, we can head reset, head reset again, and you
can see it will go away. Again after that, go to
cluster and in here, change these to five by five
or three bar by five, right? And again, head fracture. Make sure you first
you select it after that head fracture,
and it will fracture. Six is more than enough, right? Now, with that done, let's
just click on this one. Again, first, we should create a geometry collection for
it after that fracture. Click on New. It will tell you where do
you want to save it. It's really important to
be organized in here. Go to GC, the corner wall and
create the geometry there. After that, you want to
use cluster and this time, we want to make more of it. So three minimum five maximum, I want to increase it by
five by eight, right? So the minimum site per cluster, let's just change it
2-8, for example, right? No, it will have more part. Head fracture, and 26 is more than enough.
That looks awesome. No, let's just go back to selection mode and
you can see it. If you don't want to see
the colors like this, you can select both of them, and in detail panel in
geometry collection or GC tab, just disable the show bone
color and you can see it. Now, if you run over game, you can see, it will
be collapsed, right? That's how it should happen because we didn't add
any anchor field. That's why it will collapse on the pressure of the weight. What it, you can see it will be. At some point, sometimes you need to increase
this value, right? No, this top part,
I think it should be more part when
it's destroyed. So go back to fracture, right? Make sure you are
selecting it, right? And if you select it
and it is like this, it means in here, let me make this figure
so you can see it. In the hierarchy,
you are selecting the bones or the
part of it, right? You can just click on the first one and it will
select everything. After that, you can go to reset and head
reset to reset it. And, no, I want to go to cluster
and increase this value. For example, I want to reset everything to
be the default value. Make sure you select it. And after that head fracture, and you can see, No, it has 89. First, it's not a good idea
to have this much of parts, but I wanted to show you
how you can reset it, and after that, add
more to it, right? Again, go back to selection. No, what I want to do I
want to get the player start and put it there so you can see it better
at the beginning. Just put it over here,
rotate it like this. So it will face that
wall. No, you can see. It looks more natural
with more part. And we can shape it up
for, as well, right? Can see. That's it. That looks beautiful. We are destroying a column. This will be a column for us. No, we want to do the
same for the rest, but we will do it together. So let's just continue
on the next video.
29. 27 Fracture middle wall: Next, let's just go to
middle column, right? So in here, go back to middle
wall or middle column, select both of them, and
the rag and drop it, put it over here,
select one of them, for example, this base one, go to fracture mode,
right in here, click on New and
we want to put it on disruction folder, GC folder. And this time in GC folder, we want to create
a new folder and I want to call it middle wall. Right? We should be organized, head create and know
that it is selected. Let's just go to
cluster or uniform. Doesn't matter which
one you want to use. Max site per cluster. Let's just change it to three. And the minimum
number of cluster, let's just change it 3-5 because I don't want to
create much of them, so we game will be optimized. Head fracture and ten
is more than enough. This one is not ten.
This one is ten. If you click in here,
this one is six, this is ten, so that's good. It shouldn't be like each other. After that, click on this
click on New and we want to put it on the GC folder
in the middle wall, he create geometry collection. And this time, we want to
reset everything, right? So we have more part, head fracture, and
139, it's too much. You can decrease that
by resetting it, but I want to leave
it like that, so it looks more awesome, right? Just with that, let's
go back to selection, and you can see the color. We can just click
on both of them and tell it to not
show the color. And know if you run your game, you can see they are
breaking differently, and that looks awesome. You can see, right?
That's awesome. Cool. One thing that I see here, you can see when
we hit something, it's bouncing, it's
not destroying. I think we forgot something. Let's just go to APC and
open up the projectile. I think I know why
it's not destroying. It destroys not
happening because this cast is not going through. So let's just disconnect this. We have for each loop, right, that we want to connect
the complete to it. Whenever for each loop
get to be finished. This destroy will happen. Let's just start of if you
run over game and shoot. No, you can see it's
not bouncing and it's deleting, Destroy, right? Everything looks awesome
and things. Cool. Now, with that done, we need
to go for that middle one. Let's see how we can
do that next video.
30. 28 Fracture middle window: No, for doing the middle window, the important one, right? So for doing that, it
will take too much time. Go to destruction, go to assets,
static meshes, building. And in here, let's
just go to meshes, L one, we have middle
window, right? Let's just select everything and bring all of them in the level. You can see it. That's awesome. No, let's just go here and
one by one, fracture them. So let's just go to fracture. We don't need to do
all of them together. We can just click one by one. Let's just start from
this bottom one. Click on this one. This
is called base Mt clean, right? Click on New. And in here, we need
to go to GC folder. This time, we want to
create a new folder for middle window, right? And it create
Geometry collection. That's it. How many times
you want to fracture it. Let's just go to cluster. And in here, this
is too much, right? So let's just change
it to four by five and change this 30
to 15 maybe, right? Head fracture, 30 is
more than enough. This one is good.
Let's just go up. Let's see what we
want to do next. This one, for
example, click on it, and this one, again,
click on you. We need to save it somewhere. This part is just repetitive. You can just ignore it
and do it your own way, but I want to show
you to the end. Head create geometry
collection, that's good, right? And with this much of fraction
I think is not a lot. Let's say, four by eight
and two to 20, right? Head fracture and 27. I don't know if
it's good or not. We will see it, and after that, we will decide if
it is good or not. And the changing of
the color, it's good. We know that we done
this part, right? Now, let's just click
in here, this part. We don't need to
fracture it a lot, so click on New create
its geometry collection, disruption folder, JC
inside idle window, head create geometry collection. This time, two by
two is more than enough for minimum
size per cluster, a maximum one, two, by five, I think that's better
because it's wood, right? Head fracture and
that I think is good. No, it is six part. It's more than enough.
Let's just do this one. Again, it should be the same, click on New and create
its geometry collection. It should be in middle window, head create geometry collection. Head fracture, you don't need to change anything
because it is wood, should be the same as this
one. Click on this one. Again, this one, create a new. And in here, we need to put
it in GC middle window. This is really important
to be organized. Head fracture and that's it.
We've done this as well. Click on this one, and
again, click on New. You can see it is repetitive, but we should do it together. He create geometry, head fracture, that's
more than enough. And this middle part in here, again, we need to
do that as well, he create and put it
in middle window, he create geometry,
fracture. That's it. This is a small part in here. And should create that as well. Put it in GC, middle window, head create and head fracture, and this part again, head new can see
this repetitive, can just ignore this part. Let create geometry
collection, head fracture. That's good. This
part we want to do. Click on New
collapse this asset, for example, put it on middle
window and fracture, right? This part, you can see
it is a little bit big, so we need to fracture it more, click on New and in here, put it in middle window,
create geometry. This time, we want to
increase this two by eight, for example, and this one, maximum size per cluster. Let's just put it on 15. Head fracture, and that
I think looks good. Now, let's see. This
part, we didn't done it. Click on New, claps
the asset and in here, put it in middle window. And two by two, and this 16 maybe head fracture. That's more than enough.
No, let's just do this upper part like
this. This is big, right? So we need to fracture it more. Click on New,
collapse this asset, GC middle window, create
geometry collection. And this time, we want
to increase it eight by 82 to 30 maybe or five. So we have more
fracture, head fracture, 137 it's more than
enough, right? Now, we have a little
bit part at top here. We want to do that as well. Click on New
collapse this asset, put it on middle window,
head, create geometry. We don't need to be this much. Maybe three by
three for this one, five to eight for this one, head fracture. That's
more than enough. Now the window in here, the woods, first, let's
just do the woods. Click on New collapse the asset, put it in middle window, create geometry there, and
three by three is good. Five by eight is good. Let's just fracture it this way and click on this one, no, create new collapse the asset, put it on middle window, create geometry, head fracture. This frame of the window, again, we should create
it for that as well, put on middle window, head create geometry collection, and that I think
is good as well. No, we done everything. Just the glasses is there. Let's do the glasses
in next video.
31. 29 Fracture glasses: No, let's just do the
glasses. It's no different. I just wanted to create
another video for glasses. So for doing that, let's just start from
down here, right? Click on this one. You
can see, click on New. Again, we want to put
it in the GC folder, middle window because we
want to select everything, drag and drop, and
put it in our sin. Create geometry collection. And in here, this amount, I think for the glass
is more than enough, head fracture, that's good. 17. That looks awesome. Again,
for this one, click on New. You can see we are not
doing anything new. Head create geometry,
head fracture, and we want to do
it for this one, head new asset GC,
middle window, create geometry collection, head fracture 16, that's good. Let's just go up withholding right most button and
head E to go up, right? With the middle
most, we can change the camera speed so we can go up slowly like
this. You can see. With DNA, we can
go left and right. Again, let's create geometry
collection for this one. Again, create
geometry collection, head fracture, go left. Want to do this
one, click on new. That in GC folder,
middle window, head create geometry collection, head fracture. That's good. For this one, again,
click on new, you can see this repetitive. You can just ignore
DCI do completely. He create geometry
collection, head fracture. It's just head E to go up, click on this one, head Nu, put it on GC, middle window, head create geometry
collection, head fracture. Go right for this one, click on N. Class this asset, go to GC, go to Middle Window, create geometry
collection, head fracture. Sometimes we can miss something, but we can go back to it, right? It will be easy. Now,
again, this one, we want to put it
in middle window, create geometry
collection, head fracture. No, we've done this part, but we need to go up for
these two over here. Go down for this one, click on, class this
asset, go to GC, put it on middle
Window and that's it, head fracture for
this one as well, we want to do the same. It is the last one. Let's
just put it in here, create geometry
collection, head fracture. That's it. We
fracture everything. Oh, let's just see it, right? If you run over game, you
can see how it's collapsing. That looks awesome. I want to
go back to selection mode. And let's just search
in here for GC underscore to select
all of the GCs, right. And after that in here, we don't want to show the bones, so don't show the bones. And for you to see this, let's just run over game, you can see how it's collapsing. Of course, the rotation
of it is not good. So let's just get our player
start and put it over here, maybe, right over here. So it will face there so you can see it better runaway game. No, you can see everything is collapsing and we can
show it to destroy it. And if you want
something to break more, you can change the
damage threshold. Can see it. That looks awesome. Let's just look at
it one more time. The reason that it's collapsing it's because it doesn't have any anchor point and the weight of them,
it's destroying them. So we need some anchor point. No, let's just go
for the interior.
32. 30 Fracture interior: Let's just do the interior. Go to Content drawer, go to Asset aesttic Building
SFG meshes interior. Just select all of them, drag and drop, put
it on over scene. This is bring you to so we
can destroy it, as well. First, this metal part,
what I want to do, I want to go to fracture, and in here, click on New. This time we want to go to GC
and create another folder, and I want to call it interior and put the geometry
collection there. And this time, I want to use cluster and this much is a lot. Let's just change
it to two by two. And these two by four, maybe, right? That's it. Head fractured. There's
just 13 part of it, right? That's cool. This
part like on new. Put it on GC interior,
create geometry collection. This time, we want
to increase that to ten by ten,
something crazy, right? And minimum size per cluster, eight by 40 maybe something a lot fractured and that's it. 194 for this small part. This part at the bottom,
let's just click on it. Again, click on New. And in here, put it on interior, create
geometry collection. I don't want it to be this
much three by three maybe ten. This is just testing what
looks better, right? You can do whatever you want. Head fracture, and that's
it. We have everything. Let's just go back to selection
and select everything, get rid of all of these colors, right, by going in here and
don't show the bone color. Now, if you run over game, you can see when
it hit the ground, how it looks like
that awesome, right? We can look at it as well and
destroy it. That's awesome. We are destroying everything.
33. 31 Creating bulding part01: Know what you want to do.
First, clean up over level. We can do it in here, let's just search for GC. And all the GC that has building inside it,
I want to delete it. I don't want to delete
the basic stuff. You can see the basic
stuff is good here. In future, maybe you
want to test with them, so I will leave it there. Now, let's just create or
building over here, right? Let's see how easy we can do it. If we go to Content drawer no, if you go to GC folder, we have corner wall, right? We can grab these two. You can see these are
geometry collections. So let's just drag and drop, put it over here, right? Now, with that, what I want to do I want
to create a folder. So select both of them. Click on this folder and it
will put it in this folder. I want to call it
building, right? And all the building
stuff will be here. But again, I want to
select both of them, click on folder again
to create a folder. And I want to call this
one corner wall, right? And the lighting is here, and all the rest, I want to put it
inside another folder, and I want to call
it basis, right? So we should be
organized because we have lots of things
to add over here, right? No, with that, what I want to do I want to add the
middle window, right? Make sure you save
everything. Nothing is saved. Because Ao engine can
crash at any time, select everything over here, and put this over here. And right off the bat, what I want, do I want to put it in a folder before
moving it at all. So click on this, so it will put it in a folder, and I want to call
it middle window 01, right, because we want to
have multiple of them, right? Now, we want to
position it, right? For positioning them, I want
to click on this button, right, so I can see
it in all direction. I can head F, so it will go there and you can
see it over here. For this part that is in
front of it at right plane right we can just drag and
put it in here inside, and you can see the
changes over here. We can see a top side. We need to bring it inside like this and zoom in here a
little bit, go close. You can see this
part is not good, so we need to bring
it inside as well. And that I think is good, right? That's good positioning. Everything looks awesome. Know what we need. We can just click in here to maximize this and you
can see there is no gap. And we can click away now. You can see there is no gap, and it looks awesome. Now for the middle wall. So in here, go to middle wall, select both of these
withholding control, selecting both of these. Put it over here, right. Again, click on this and go at top side and put it at
roughly good position. We will zoom to see
if it's good or not. We can unzoom a little bit this, and this should be on
one line like this. And let's just zoom in here a little bit to see if
there is any gap. You can see the gap. We can bring it inside a little bit to see
if it looks good. I think that looks awesome. You can see it's on
one play as well. No, we did one part, right? That looks awesome. Again, let's just click in here, Run over again, and you can see it get destroyed
and it looks awesome. When we add the anchor point, it looks much better.
We did this part. I want to do it in
multiple videos so you can reference
to it, right? No, I will see you
in next video.
34. 32 Creating building part02: Now let's just continue
creating over building. In here, we did some part of it. Before doing anything else, I want to select both of these, create a new folder, and I want to call it
middle wall, 01, right. So we will organize and we
can put it in building. But right now, let's
just not do it for no, let's just leave it like this. Now, this part, we want
to do it the same. So let's just go back in
middle window, again, select everything,
put it in here, click on this over here. And no go to top can see we want to bring it like this
to be aligned with this one, we can zoom a little bit. So we see what we are
doing, bring it inside. And in here, we can zoom a little bit to see if
it looks good or not. I think it looks awesome and the
positioning of it is good, and it is aligned. That's good. No next thing, again, let me click in here. We want another one of
this middle wall, right? But before doing that, I
want to click in here and call this one middle window 02, right to be organized. No next thing, we need another one of this
middle wall right there. Again, click in here
to position a good. We can bring it over here. It should be aligned
with this one. So let me bring it closer
like this, not align. I should go back a little bit, and I think that's good. Should bring it
inside a little bit. Now, we should go here to
see if everything is good. Yeah, I think that looks good. We can put these two
in a folder as well. So click on New folder
and I want to call it middle wall 02, right? And that's it. Know
what I want to do. I want to add another
one of these. You can see take lots of time to create these
kind of buildings. But this is how we
should do it, right? Put this over here,
click in here, and position it like this. Bring it over here to be
aligned with this one, right? Bring it over here.
I think that's good. We should zoom in here a little bit to see if
everything is good, and I think that's good. No next thing, we
need another one of those corners because this
part of it, I think is good. One of these corners
should be derno. So let's just go here
and corner wall, select both of these,
put it over here. But this time, we want
to rotate it, right? So head E, so you can rotate it. For the rotation, I want to
change these 245 degrees, so it will be easier to
rotate it like this, rotate it one more
time, and that's it. No, we can go to that
top view to put it at the right position headw so you can change
the position of it. No, we should see this one
to align this one with it. Go inside, and in here,
let's just look at it. I think that looks awesome, and we create one
side of it, right? You can see we did
create one side of it. And now, let's
just test that out in here and run our game. You can see everything
is collapsing, and that looks awesome. That is working fine. When we put Anchor point, it looks much better as
35. 33 Creating building part03: Before moving on,
this corner wall, I want to put it inside another
folder. So click in here. I want to call it
corner wall, 02, right, and all the rest, it's another middle window, middle window, three, right? So click on folder, middle window 03, right? Everything is organized. That looks awesome. Now with that done, we want to duplicate this
for the sides, right? So let's see if we can do that. Click on everything like this. Like this, right,
click on one of them, select all the
descendant, right? And know it's the
time that all of these organizing folders will collapse a little bit because it will create it in
those folder, right? But the good thing about it, we can grab all of this and know because
we was organized, we can create another
folder for all of this. And I want to call this side 01. Right? No, all of this
part is inside this love. We can just delete these
one. We don't need them. And this one and this one, the buildings we want it, right? Now inside this side
one, we can right, click on it, go to select
all the descendant, right? And now we can
duplicate it, right? So hold out,
duplicate like this. And before doing anything, click on New folder
again and call it site 02, right? That's it. It will be inside the side 01. That's okay. We will fix that. So in here, we can
select everything inside one like this holding
shift, select the first one. And while we hold in shift, select the last one,
create a new folder. I want to call it site 01 again. And this side 01 that
we have in here, we can call it building, right? We will do this kind
of stuff a lot. B ding because we don't want
to lose be organized, right? At some point, you may say, why you are not using level instances and
blueprints and all of that, because we are using geometry
collection and doing it with those after
that for coding it, it won't be easy to do. It will be much more harder. So this way, we should work just with
geometry collection. We shouldn't put it in
level instances, right? So in here, the side two, I want to right click on it, head select all the descendant, I want to rotate it, right? So like this, we
rotated 90 degree. That's cool, right. Now with that done, we want to position it
close to there, right? And because we have
this corner in here, we can just click on this
corner, delete it, right? And again, the side too, right click on it, go to
select all the descendant. Now, we can click in here
and put it on right spot. Of course, it's not that easy, but let's just go inside
like this on that right. And in here, can
see I can bring it inside like this and bring
it inside like this. Now let's just go and check
it out if it's okay or not. And I think there
is no gap in here, so everything is good. One other side, we
done it, right? No, just click in here,
click away, right? And now, you can see
everything looks awesome. Everything looks beautiful. And we have two sides
of the building. We have two more, right? There we can just copy and paste all of these and do this part, but I want to have the
sides correctly, right? No, it's easier to
work with side one, side, two, side, three,
side four, right? It's easier this way. No, we done two side, we need to do two more
side. We will do it in next
36. 34 Creating building part04: No, let's just do
the other side. So for doing that, I want to get the side two, right click on it, click on select all
the descendant, and hold out and drag so
we create a copy of it. And after that, without
doing anything else, click on, create a
new folder for it. I want to call it
side 03, right? And with that,
right click on it, go to move two, right, and move it into the
building folder, right? Now we have side
two and side three. That's awesome, right? Now, with that, we want to rotate it. So head E, so you can rotate
it like this, 90 degree. And we want to position it roughly at the good
spot like this. And after that, we can go
to the top view, right? So we can position
it better like this, bring it down like this. And in here, let's just zoom to see if it as any gaps or not, I think that looks
awesome. Perfect, right? There is no gap in
here, so that's good. And if everything is good, we can just select all of
these and put it over here, copy it, and it should
connect these two together. But if we didn't
position it good, we have a problem, but because we did put the
sides inside its folder, we can reposition them
really easy, right? So click in here so we
can see everything. Now we want to duplicate
this one more time. So hold out, duplicate, right? By drag and drop in. I did call it side four, so that's good, right? No, with that, we need
to position them, rotate them 90 degree like this, position them roughly like this. And what we want to
do in this side four, we need to click on
this one, deleted, click on this one, deleted, and right click on side four, select all the
descendant, right? And now we need to position
them right like this. After that, we can go
to top a clicking in here and position it correctly. Over here, bring it inside, and I think that's good, but let's just zoom in here a little bit to see if
there is any gap. This time is good. And this one, you can see it. It is a lot inside. So what we can do, let's just bring it inside
a little bit, like this. I shouldn't be this much inside. This part, again, you can
see that doesn't look good. There is no gap. A little
bit, bring it this way. Of course, nobody
noticed this part. I want it to be perfect. Now, let's look at this part. Yeah, that's not good. This part is good, but
this part is not good. So that's why I want
to move the side tree. Let's just go up and
choose the side tree. So right click on side tree, go to select all the
descendant, right? And on this top part, I want to see, you can see
these curve lines in here. I want to see it
over here as well. So let's just bring it
outside a little bit, and no we can see it. Let's just go this way. We can see it over here. And this way, we can see it. There is no gap as well. So everything is good no, right? All the sides are okay. We can select the way and test that with NO.
Click in here. And if you click away, you can see that looks awesome. Perfect. Let's just run
we game and you can see the building
will be collapsed, and that looks awesome. Now, next thing we need a roof. Let's see how we can
create a roof next to
37. 35 Creating roof top: No, let's just
create the rooftop. For doing that, go
to Content drawer, go to GC, go to interior,
select everything. R and drop it, put
it on or level. And in here you can see
we have some parts. If you bring it up, you
can see at beneath it. Let's see it. You can see for the rooftop, it's okay, right? No, we have one metal
part that should be on other sides as
well. So select it. We want to duplicate
it, hold out to duplicate like this and
head E so you can rotate, rotate 90 degrees,
head D so you can move it and position
it real good in here. And it's not okay right now. Of course, you can
change the step. Just clicking in
here, you can change the step when you are
moving the stuff, right? So, no, with that, we need to duplicate it one
more time for this side. And with that, let's
just head E so we can rotate at 90 degree head W so we can move it like this and go close so we can see if you
position it correctly. Yeah, everything is good. No holdout, duplicate
it one more time, head E, so you can rotate it 90 degree head W so
you can move it. No, let's just put it over here, and I think that's
good positioning. Cool. No, I want to select
all of them and change the Z of them to zero
to be at bottom. It's easier to work
with like this. And no, I want to duplicate
this whole thing. But before doing that, I want to put all of these
inside the new folder. So with all of them selected, I want to click on New folder, and I want to call it
roof part 01, right? And no, we want to duplicate it. So select everything, hold
out, duplicate, right? And you can see, sometimes it's automatically create a new
folder and name it correctly. So that's awesome
to have, right? Now, this one, we want to
connect it to this one, so we need to delete
this one in here, right? Now, again, we can
just right click on the rooftop number
two and select all the descendant and
position it really good. Just bring it close like
this. Now, let's just zoom. You can see there is a gap. Bring it inside a little bit. You don't need to
be that perfect, but yeah, it looks
much better this way. Now, we have rooftop
to select it. Hold on, duplicate
it one more time. And no, let's just
position it good in here. Without selecting anything,
create a new folder for that it is Roof
part 03, right? And with that done, I
want to right click, go to move two and
put it on building. Cool. And these two rooftop, part one and Roof part two. I want to right click on them, go to move two and put
it on building as well. No, one part of it
is finished, right? No, let's collapse everything. We want to select all of them, right click on one of them, go to select and select
all the descendant. Cool. No, we want to bring
it inside and bring it up after that and position it to see if everything fit or not. You don't need to have a perfect alignment in here because it will
be destroyed, right? Oh, let's just put it over
here, bring it over here. The important thing is
that this part, right? This part should be
aligned correctly. Like this, I think
is looking good. It's a little bit up, so we need to bring it
down a little bit. Bring it like this in here. And now we can
position it better. We can bring it outside
a little bit more. Go here to see everything
is okay or not, but there will be
some overlapping. It's okay. Cool. Everything is at right position. Cool. Now with that done, we can put all of this inside
another folder, right? Because we want to
duplicate it three time. So with everything selected, click on new folder, and I want to call
it proof. Top 01. This time, I did call it rooftop and let me go up and
delete those roof part. We don't need them anymore. We just use them, right? And with that, I want
to put the rooftop, right click on it, go to move two and put it in
building, right? Cool. Now, we want
to duplicate it some more time to create a roof. So for doing that, right click, go to select all
the descendant and no holdout drag and drop to
create copy of it, right? And right off the without
positioning them, I want to create a new folder
and I want to call it roof. Top 02, right,
right click on it, go to move two because
you want it to be organized. Put
it in building. Cool. Now in this rooftop two, we don't need this iron in here. We don't need this
metal over here, right? Now with those deleted, we can just right
click of roof top two, go to select all the descendant. No, we can position it good. Let's just go here, see if you are positioning
it good or not and get inside like this. Little bit more. That's it. Now, we have the third one. We need to duplicate
it one more time. So hold out in here, dragon it up, create
a copy of it. This time we can position it before moving it in new folder. So let's just position it
good in here. That's it. And we can put it on new folder, want to call it roof top 03, right? Right click on it. Go to move two and
put it in building. No with that done, you can see the
alignment of them. These parts are not that good. So we need to select everything and move them a little bit. So this and this right
click on one of them, go to select all the descendant. Now with that done, let's just position it good in
this way, as well. And I think that's good, right? This part is positioning good. This part is positioning
good as well. No, over rooftop is finished and everything
is aligned, right? Cool. We have the rooftop. Make sure you save every
38. 36 Roof gaps: One problem that we
have our rooftop, you can see there are some
parts that are far away. How we can fix that
it's matter of positioning things and designing things for this
part, for example. Or we can just click
on here, hold out, duplicate it, and create
another metal and position it. We're here to fill up
these gaps, right? We can do multiple
oven just by holding control and holding Alt
and duplicating them, and position them in here. We can do it for
this line as well. Hold control, select this
one, this one, and this one, hold out, duplicate them, and position them
good like this. Now, for this part,
again, click in here, hold controls like
this one and this one, hold out and drag and drop drag. So you duplicate it
with holding Alt. No position it good. Now in here, again, I want to select this
one, hold controls, like all three, hold out
now for duplicating them, and position them, right? That I think looks good, right? Or it is too inside. We can bring it outside a
little bit, and that's good. You know, our rooftop
is good and finished
39. 37 Damage threshold: Know that our
building is finished, we need to change
the damage threshold of the things that is inside it. So, for example, these glasses needs to be broken with
less forces, right? So for doing that, I want to
go to Outliner and in here, search for glass, okay? Whatever glass that
we have in here, Control A to select
all of them, right? You can see all the
glasses will be selected, and you can see it over here. All the glasses is selected. Go to GC, go to
damage threshold, and I want to divide them by 20. So it will shatter much faster. So divide all of
them by 20, right? And know with thatt,
if you run over game, the glasses will shatter much
faster and easier, right? Of course, everything
is shattering, but you will see the difference when we
are destroying stuff. Now with that done, we
have woods as well. Now for the woods. Let's see what is the
difference between the woods. If you go to middle window, you can see all the woods
are in the middle window, and they have window inside it. You can see there is
window inside it. And if I go here, there
is no window in this one, there is no window in this one. So in here, if we search for Window and select
everything with Control A, no, you can see all of
the wood is selected. Now with that done, go to GC, go to damage threshold. You can see it has
multiple value on the first reset,
all of them, right. And after that, go here and
divide it by 15 maybe, right? To make it less
resistance to the force. Okay? Divide this one by 15. You decide what value you want to divide
or multiply, right? Concrete should have less force needed for it to be destroyed
rather than this metal. But I think just with
that, it does look good. If you run over game, again, you won't see not
much of a difference, but at future, you will see it looks much better
with anchor point. Now, the glasses
will shatter much easier and woods
will resist more, and the concrete will resist more than all of them.
That looks good.
40. 38 Convert building to blueprint: No, we have we're building with the right damage threshold
for everything, right? But no, we want to
add anchor point. Let's see how we can do that. For doing that, there
is a couple of ways. For example, let's say we
want to add anchor point. So go to destruction folder, go to asset fields, and add anchor point drag and drop an anchor
point in here. We want to make the
size like this bigger, like this, bring it up. Like this, of course,
I need to bring it. Make it more smaller
like this, right? So know what you want to do whatever that this
anchor point touch. We want to add that anchor point to
its initialized field. For example, this
one, holding control, select this one,
this one, this one, this one, this one, right, and this one, this one, and this middle part
as well, right? Select all of them
one by one and go to initialize field and
add them there, right? But this will take too much time to optimize
ways to do it like this. But it will be like
40 hour course because we have lots
of things in here, and we want to add
lots of anchor field. It's not just once for
the columns, right? We want to do for
this wood, as well. We want to do it for
this wood as well. We want to do it for
this wood as well. We want to do it for all
of the metal part as well. So we have lots of them. It will take 40 hours to
finish this course, right? We don't want to
do it like that. Other way that we can do it, we can tell it whatever that this anchor field is
overlapping with, take them and add
this anchor field as their initialized field
initialization fields, right? But right now, there is no
good node for doing that. Maybe they added in future, but right now, there
is no option for that. I did work on some
workaround for this to add some box collision and all of that to this field. But again, the problem
with it is that whenever we use
overlapping actors, it will crash on
your engine, right? So that's why we can't
use that as well. But the best way that I
found that it's easier than all of the ways is by
doing it with blueprint. So let's just delete this what we want to do we want
to select everything. So go to Building, make
sure you right click on it, select all the descendant, know everything for our
building is selected. Hold on. I want to duplicate it because maybe
you make a mistake. We don't want to delete that. And with that, we
want to click on New folder to create a
new folder and I want to call it main build ding,
main Building, right? And inside this main
building, right, click on it. Go to select select
all the descendant, know that everything
is selected. Go to this icon and convert the selection to blueprint
class. Click in here. Now, it will tell you,
do you want to create it as child actors or
harvest components? If you want to edit
our building later, it's better to click
on Harvest components. So it will harvest
everything for us, right? Next, the parent class, what do you want to choose? The actor is more than enough, but if you want to put it in
whatever you can do that, the actor is more than enough. And for the naming, I
want to call it BP. Destructb building destructible
building BP for blueprint. No, it will tell you where
do you want to save it. So click in here,
and I want to create a new folder inside
Disruction folder, and I want to call
it blueprints. So all of our blueprints
will be here, head o, and no head select. It will convert it to a
blueprint class. You can see? No, we can edit things in here
and everything seems good. But we are in a blueprint. It's faster to work with it. And no with that
inside this blueprint, we can add initialize
field to it. Let's see how we can do that.
41. 39 Adding ancher fileds: Now, let's see how we can add anchor points really fast
without going through all of these geometry
collection to add to them one by one, right? For doing that, you can see all the geometry collection
is as a child of shared root. I want to name this
shared root to building. After that, I want to click on this building SM component and click on AD and create
another SM component. This SM component is just
for organizing the stuff. This one, I want to call it GC. So all the geometry collection will be inside this GC, right? So let's just select
everything and deselect the GC and let's just go up
and deselect everything else. Just the geometry collection
will be selected. And what I want to do, I want to put them all of
these geometry collection in as a child of or
GC scene component. So dragon drop, put it there. Nothing will change. We will be just more
organized to work with. Now with that done, you can
see nothing is changed, but we are more organized. With that, click
on the building, add another scene component. And this one, I want to
call it anchor field, AF for anchor field, right? No, let me collapse all
of these. You can see. We have one SM
component as a parent of all of the geometry
collection that we call a GC, and we have AF for anchor field. No, let's just add anchor field. For doing that, go to
destruction folder assets field, and we want to add
a anchor field to this anchor filled in here. Again, it will
expand everything, but you can see the
anchor filled in here. It is at middle in here. So first thing first,
let's just do some part. If we bring it outside, we will duplicate it a lot. For example, in here,
what I want to do, I want to put it
for this column, right, and make it bigger. So it on our keyboard to make
it bigger so we can see it, make it bigger this way. We want to bring
it down a little bit and make it bigger
this way as well. It will be from middle. So let's just put it
on middle like this and that we make it
bigger and position it. This positioning stuff
take lots of time. But if you put
enough time to it, it will look much better. Or project will looks
much better. That's it. And now you can see we have
an anchor field that we can use to grab all of this
stuff from falling apart. I want to make it bigger
this way, as well. And this way is good. I think we will change
the size of it later. But for now, I think
it looks good. You can see it is
bigger because we want to overlap
other stuff as well. Now with that done, I
want to click in here, Control D to duplicate it. You can see it will
create another one. This one, I want to
use it for this one. But this one, we want
to make it smaller. So smaller this way. Like this and change
its position. So it is at middle. If you go inside, it should overlap everything
in here as well. No, with that on. Let's just
duplicate it one more time. And in here, we want to use this one for this
column in here. That's good. It's
overlapping everything. No, I want to duplicate
this first one, Control D to duplicate it. This one, we want to use
it for this one over here because this needs
a bigger one, right? That I think looks good. Let's just duplicate
this 11 more time and put it for
this one, like this. And I think that looks awesome. We need to position it a
little bit better like this and know everything
I think looks good. Now again, duplicate
it one more time. This time, we want to use it
for this column over here. Now, let's just bring
this over here like this. Okay. We want to overlap
everything so it feel protect all of these parts from
destroying by itself, bring it a little bit
outside as well, like this, and know all the corners are
okay, what I want to do. I want to copy and
paste this one, for example, click on this one. Control D to duplicate it. And this one, I want to use
it for this middle part. Let's put it on
middle like this. And let me put it over here and make it a
little bit smaller. So head R so you can make
it smaller, like this. In future, we will change that based on the
result that we get. Let's just duplicate it again and use it for this
column like this. And that's it. Now,
for this part, I want to grab one of these on this part and Control D
to duplicate it, right? And I want to go up so
I can move it better. Put it for this one. You can see it's easier like this,
everything good. Now for this one, I want to select it like this, head Control D to
duplicate it and change its position until it's overlapping with everything
in this side as well. Now, for this part, again, at this top
side is easier. Click on this one,
Control D to duplicate it again and put it on this
side, right, like this. And now, we can grab this one. Control D to duplicate it and
put it for this one, right? No all the columns are okay. So if we add all of these anchor fields
to whatever that it is touching to whatever geometry collection
initialized field, what will happen,
it will protect these parts from
falling down by itself. It's not enough.
Just bear with me. So I will explain how
you can automatic add them to the
initialized field of the geometry collections. After that, we will add more anchor fields so it
will protect all the parts. For example, if we leave
it just like this, this part will fall
down completely, right? Some of these glasses
will fall down. Some of these glasses
will fall down. So just with that, no, let's see how we can add all of these anchor fields
that is inside this AF to all of the geometry collection that is inside this GC and next video
42. 40 Initilization fields: We did add some anchor
fields to our building, but with it, if you run over
game, nothing has happened. Before running our game, I want to click on the building, create a copy of the project because when we
delete this building, we can't go back to it, right? So I want to just delete this building and
delete all of these. And with that building deleted, let me delete the rest. We have a blueprint that
it has over building. If you run over game, you can see it will be again
destroyed like always, because we didn't add
these anchor fields to these parts to its let me go down to initialization fields. We didn't add it, so that's
why it's not working. Again, one way to do it, we can just click in here
and select everything and add the initialized
field to them, but it will take too much time. How we want to do
it really fast, we can go to construction
script and do it in here. So for doing that,
we can get this AF, that all of the anchor
fields are a child of this, and we can get the
children component, get children component, right? And we can tell it to
include all the descendants. So all the anchor fields, it will give us an array. We can just right click on it, promote it to
variable and I want to call it anchors,
right? That's it. We can just grab this
construction, scrip to there. Now, all of these
anchor fields will be saved inside this
variable, right? Again, we want to get all of the geometry
collections by getting all the children all the
children's component of this GC scene
component, right? And again, we want to
include all the descendants, and we want to right
click in here, promote a variable,
I want to call it GCs with an S, right, DCs. So all the geometry
collection will be here. And after collecting all of the anchor fields and the
geometry collections, for all of these
geometry collections that we gather over here, we want to add all of the anchor fields to
its initialized field. And how we can do that,
we can use for each loop, right, connect the
execution pin to it. These construction scripts will happen whenever we head compile. That's why after this, every time that we had compile, it takes a little bit more
time to do so, right? Know what will happen if we
have ten geometry collection, this loop body will happen ten time and each time it will
give us one of them, right? So first thing that
we want to do, we want to get this
array element, and we want to cast it to geometry collection
component, right? With that, if it is a geometry
collection component, we can get its
initialization field. So search for now down, get initialization fields, and add the anchor fields to it. We don't want to just
add one anchor field. We want to add all of
the anchor fields. So how we can do that, we can get all of the anchor fields that
we saved in here, again, use another
for each loop, right, and connect
execution, pin to it. And this will give us all
of the anchor fields. And because all of
the things that is inside the anchors array, Al engine doesn't
know what it is. That's why we need to cast
it to child actor component. First, Okay? First,
we should do this. And after that, with this, we want to get the child actor, get the child actor. And with it, we can cast this two F is anchor
field generic, cast two F is anchor
field generic, right? So what this will give us, it will give us all of the anchor fields that are
a child of this AF, right? And we want to add
all of them to the initialization field that we geometry collection have. So in here, we can
say at, right? And add this to it, it need execution pencil. Let's just give it
that, and that's it. Now, let's just head compile. I will explain it one more time. You can see when I head compile, it takes more time
to be compiled. Now, if you run our game, you can see our building is
not destroyed by itself, but as you can see, the glasses and the woods will be destroyed. If you shoot at one thing, you can see it will be down. Shoot at this one, you
can see it will be down. That looks awesome. Let me
show you one more thing. If you go at top because we don't have any
anchor field in here, when we go here and
tell it to simulate, you can see this part
will try to go down. Of course, it's facing
like this and you can see, no, it did go down. You can see the glasses are down and everything
is collapsing, right? But because these parts are
inside the anchor field, that's why it won't
collapse by its own. Now, let me explain
this part more. What we wanted to do.
Every geometry collection, we wanted to add anchor
field to it, right? So in here, we should go down, go to initialization field
and add all of the anchor fields to here by clicking in here and add anchor
field to it, right? But in here, what we have done, we get all of
geometry collection, and we cast it to geometry
collection component, and we get the
initialization field array, and we add all the
anchor fields to it. That's what we
have done in here.
43. 41 Anchor filed for windows Explaining: No, let's just add
more anchor field. Let's just go here, go to
viewport and what I want to do. I want to click on this one, claps this one, and let's
see which one is it? This one. Control
D to duplicate it. We need lots more. Bring it over here. We need to change the size. We can just do it like this. One in there and one is too
much, 0.5 maybe, right. And with that, no,
we can position it. I want to position
it for this in here for this root that
we can use it as column, right, and bring it inside. I want to change the position in each direction
like three, right. It's too much this way. In wide direction, just one, I think is more than enough, and maybe 1.5 and bring it outside a
little bit like this. So it will cover
this glass over here and this glass down here and
the wood in here as well. Now, we need to duplicate
this one more time, control D to duplicate it, and now we can bring it to the right to
protect this part. Again, control D to duplicate. You want to do it for
this part down here. Let me go down to see if
it supports everything, bring it down a little bit. Every time that
we add something, it will compile automatically. That's why it takes
a little bit time. Control D to duplicate. And this time, I want
to bring it over here. No, the glasses shouldn't
fall off at all. Let's just test. If
you had compile, save, make sure you save always. And this side, let me
see the player start. Where is it? Player
start this way. So let me put the player
start in that way, like this. So we can look at it, right? These glasses
shouldn't fall off at all like this and
bring this over here. Rotate it like this. I know if you run over again, you can see the glasses
in here is okay. It's not moving until you
shoot it, right? You can see. When we shoot it, it looks
more natural, right? But these glasses up
here, it's collapsing. So for fixing that, let you just go here. I want to duplicate this one, so control this to duplicate
and bring this up. For these glasses
that we have in here, just like this, bring
it down a little bit, can bring it to the left. Just like that, it should
protect the glass, and I want to add one more
control D to duplicate. I want to put one on this
side as well, like this. I'm recording and I'm
doing this, as well. That's why the speed
is not that good, but on your machine,
it will be better. Head compile. No. Let's
just look at it. Runo game. I know you can see This
side is really okay. Everything looks awesome. Nothing is collapsing. Know what you want to do. We want to do the same that
we done for this window. Do it for other windows as well. This is a repetitive
mission, right? We need to do all of these
for this part as well.
44. 42 Anchor filed for the rest of the windows Part01: No, let's just add the
rest of the anchor point. So in here, I want to use
Control D to duplicate, right, and put it over here. Zoom a little bit, so we can put it over here, duplicate
one more time. Put it on this side,
click on this one, duplicate and bring
it over here. 42 be a little bit faster. I want to go here and tell
it to change it to unlit. This way, it's a
little bit faster. Duplicate this one, bring
it to the left. That's it. Another thing that we can
do to make it faster, we can go to
Construction script and disconnect this one so it
won't compile anything. And this should be a
little bit faster as well. Control D to duplicate
this one, bring it down. You can see, no, it
is faster to do so. And click on this one, Control D to duplicate
and bring it down here. And that's it. No, we should do this part, so Control D again. Sure, everything is okay. Control D to duplicate. I want to do this side like this and Control D to
duplicate one more time. Bring it this side, Control D to duplicate one more
time, bring it up here. Control D to duplicate one
more time, bring it up here. Cool, right? Control D to
duplicate one more time. Bring it up here now, like this. Control D to duplicate one
more time, bring it over here. That's it. This
part is finished. No, we want to do this part. So let's just get this one, control the to duplicate,
bring it over here. Change the size to 0.5, right? And this one, two, maybe. And this one. No, with that, I
think that's good. Can bring it over here
and use it for this one. Cool. Control D to duplicate,
bring it on this side. Maybe we need to bring
it inside a little bit, as well, but it's okay
on this side as well. It's too big, right? Control D to duplicate, bring it down. Control D to duplicate one
more time, bring it over here. Control D to duplicate. We want to do it for this one. Control D to duplicate
one more time. D, sizing the direction. I want to put it down 1.5 maybe, right, because it's
too much right now. Control D to duplicate,
bring it up. Control D to duplicate,
bring it over here. And no this one over here. I'm using Control D to
duplicating stuff, and that's it. Control D, bring it over here. At the end, we will
test it to see if we did make any
mistake with that done. Let's just go here,
duplicate this one, Control D. It doesn't need to be perfect because the
buildings in real life, it's not that perfect, right? So let me bring this down
a little bit. That's good. Control D to duplicate, bring this over here. Now
with that down. Control D to duplicate one
more time, bring it over here. A little bit to the left, so it filled face everything. Control D duplicate one more
time, bring it over here. Cool. Control D to
duplicate one more time, bring it over here like this. Control D to duplicate
and put it over here. Cool, right? Now, we
should do this part. For this part, let me
copy one of these. For example, this one, and
use Control D to duplicate and bring it on this side like this and no we
can position it. We get over here.
Cool. Control D to duplicate, bring
it over here. Control D to duplicate. You can see we are
just duplicating and putting it in
wherever we want.
45. 42 Anchor filed for the rest of the windows Part02: Control D to duplicate,
bring it over here, and Control D to duplicate,
bring it over here. Control D to duplicate,
bring it over here. Now, this down part, L in here, control D to duplicate, bring it over here, down, so you can see if it's okay. Control D to duplicate,
bring it down. Control D to duplicate one
more time, bring it over here. Control D to duplicate
one more time in here, Control D to duplicate
and bring it over here. Control D to duplicate. Control D to duplicate. Control D to duplicate. Control D to duplicate
for this side. Control D to duplicate,
for this side. Control D to duplicate for this, Control D to duplicate. You can see with Control D and duplicating how easy it is. It doesn't need to be perfect. So in real life,
nothing is perfect. Now, let's just copy
and paste one of these, Control D to duplicate and put it for that side like this. Over here, bring it inside
a little bit like this. And that I think is good. Control D to duplicate,
bring it over here. Control D to duplicate, bring it over here as well. Control D to duplicate one
more time, bring it over here. Control D to duplicate,
bring it over here. It's almost finished, right? Control D to
duplicate over here. Cool. Control D to
duplicate, bring it down. And here, everything okay? Control D to duplicate. Bring it over here. Control D to duplicate, bring it down. Control D to duplicate one
more time, bring it over here. Throw D to duplicate one more
time, bring it over here. This time, let's just decrease this value to 0.6 because
it will be easier. With this size to position aperture, Control
D to duplicate. Control D to duplicate,
bring it over here. Which was D to duplicate,
bring it over here. Good. Control D to duplicate,
bring it over here. Which one D to
duplicate, bring it up. Control D to duplicate,
bring it to the left. T D to duplicate, here, and that's it.
Everything is finished. Know that everything is
finished for the windows. Let's just go to construction
script and connect it. This will take too much
time. Head compiles. If you run over
game, you can see some part of it is
collapsing by its own. It was working before.
Why it's not working now? If we go here, you can
see first we are include all the descendant
forgeting anchor fields and geometry collection. By checking this, it
will create a bug. I will go through everything that is inside the
geometry collection. I don't know what
is the exact bug. But if you just don't include all the descendant all the descendant if you hover over it, it means grandchildren
and great grandchildren. You can see it in description
when you hover over it. We don't have any
grandchildren in here. It's just all the
descendant of it. There is nothing after GC or AF. Just the geometry collection. Just with that, if
you head compile, no, it will be faster a little
bit, if you run over game, you can see everything
is good, but you can see some part of it, it's getting away like this. There is a problem.
We will fix that. Now if you shoot
here, you can see, I will delete that and
you can see how it looks. If you shoot in here, no, you can see a problem.
Just look at that. Window up there because it has a anchor field
applied to it. That's why it is in the sky. This is first problem
that we should fix. But this part that we have in
here that it's collapsing, it's because some part of it, it's not inside
this anchor field. So at some point, we need to increase the size of
these anchor fields. So for example, this one, I want to make in the wide
direction a little bit bigger, like 2.5, like this. Now with that done, if you
go here and run our game, you can see that part is not breaking down anymore,
it's not going down. But as you can see,
the roof will go down. You can see the
roof will go down. That's why it will
break some part of it. If you go at top and in here, go and click on simulate, you can see this top
part will go down and make the other part
collapse sometimes as well. You can see right now
there is no problem. Again, there is a
problem in here, no problem in here,
everything good. So this part have
problem as well. We will fix all of these
problems by making these bigger, and after that, we
will go and create anchor point for the rooftop.
See we can do that in
46. 43 Fix falling part: First problem that
we have in here, some part it's falling down. So what I want to do
I want to make this a little bit bigger
in the y direction. This is good. Let's
just click in here. Change this to 2.5. I think 2.5 is more than enough. Go here for this part, this in X direction, we should make it bigger
in x direction, 2.5. You can see the
direction is in here. A click in here,
change this to 2.5. Now, let's just go on this side. In this side, we need to
change it in the Y direction. So 2.5 for the Y direction, again click in here. And for the Y, 2.5, this should fix
lots of problems. No, for this part, this is X, should change it to 2.5
and do it for this one, 2.5, and that's it. All the problems
should be fixed. Let's just go to our
level and run over again. You can see there
is no falling part for you to see it better
when you click in here, he simulate and go around it. You can see there is no
falling part anymore, just the top of it, right? So I want to give you
as a challenge to you. Create some anchor
fields for top part. You try what you want to do, and we will do it in
next video together.
47. 44 Roof anchor fields Part01: No, for the next part,
we want to do the roof. So let's just go here and
let's just do the roof. For the roof, let's
just grab one of these. Control D to duplicate, and I want to change the size, for example, to tree maybe in Z direction and bring
it up to look at it. Of course, it's better to disconnect this
construction script when we are doing that. Viewpoint, this way is easier. Now with that done, the size in the wide direction, I want to decrease
it to maybe two. That's good. Know
what I want to do. I want to bring it in middle. Like this, I change the
size in Z direction to two maybe because
it's too much right now, and that's better. This one, I want to
change the size in x direction to five
maybe, and that's it. It is covering everything. It should cover this part, middle part as well.
That's good, right? Now, with that done, I need to duplicate this control the duplicate and put this
duplication over here. But this time, what I
want to do I want to change the size in its
direction back to three, right? It should be randomized. It shouldn't connect
to everything. Maybe we can bring it a
little bit this way as well. That's it. This
side is finished. Control to duplicate this one. And let me bring this over
here and over here, right? I think this way is better. We need to randomize
a little bit, so it looks more natural. And this way, it should
be connected to this one. So it's connected there. I didn't look good, right. And I want to
duplicate this one, control D to duplicate, and bring it over here, and after that,
bring it this side. This one should get
the middle as well. So let's just bring
it over here, middle a little bit, and bring it outside. Like this. So it grab the middle
as well. That's it. This part is finished. Now, let's just duplicate
this one more time. And I want to rotate this one. So at E, rotated 90 degree like this at
W, so you can move it. I want to do it for this one, like this, bring it inside. I don't want to touch
this one, so that's good. No, I want to duplicate this, control D to duplicate, and I want to put
it on this side, like this, bring it over here. That I think looks good. It shouldn't be perfect, right? Now, again, I want to
click on this one, Control to duplicate and
bring it for this one. But this time, what I want to do I want to change the
size in this direction, headR, you can change the size. For some reason, it's
changing it in other site. Maybe we should click in here
to go to local space and know we can increase it
in this direction, right? Now it's working at W, so we can move it a
little bit forward, so it will support
the middle one. That I think is good. Now, control to
duplicate one more time, bring it this site. We want to do it for this part.
48. 44 Roof anchor fields Part02: Like this, and it needs to
touch this column as well. So put lets bring it so it
will touch it a little bit. And it's not touching
the middle part, so we should maybe
make it bigger. So in each direction, we need to change
it to five, right? No, it is touching it. Bring it bit to the right. And look at it, it's like
it's not inside this one, so we need to bring
it over here. Maybe just put this one to six, add more randomization
to our building. That's much better to add more randomization
to our anchor point, and our anchor point is
inside this one as well. This part, I think this is touching this
and touching this. Yeah, everything is good. No, we should go to
construction Script, connect this to here
and head compile. It will take a little bit
time to get compiled, but it's just once. Now with that done, let's
just go to our level. I want to use simulation to see if there is any
problem, so simulate. Now, you can see
nothing is happening, but if you go inside, you can see this part
is falling down. So let's see how
we can fix that, go to building, go to Viewport. Let's just go down to
see if it's touching it. Yeah, it's not touching it. So these parts, we need to change in Z direction to
trim maybe for all of them, or making it fast. Again, disconnect
this, go to Viewport, select this one this time, change it to tree and change
this one to tree as well. We can select all of
them together like this. Select this one,
this one, this one, and this one, and change in Z direction
to tree. And that's it. Go to construction script, connect it like this,
help compile now. And know if you go here, you can see it's not
touching it completely, so we need to make it bigger. So again, disconnect
this, go to Viewport, and for example,
let's make this one bigger in what direction in
its direction to six maybe. And with it, I think
it's touching it. We need to bring it
down a little bit, because if you go inside, you can see it's not
touching that middle part. That's why it's going down. So just change this to 900, so it will go down a little bit. Again, change this
one in x direction to six with that done,
should be okay, this one, again,
changing direction to six and bring it a little
bit outside like this. Now, let's just go down to see if it's touching it or not. It's not completely
touching it all of them, but I think that's okay. Let's just go back in here and connect it like this headcmple. We need to test a lot to see if there is any problem
with our building. No, let's go to our level, run, simulate, and now you
can see it will stay there. That's good. No,
you can see none of the parts is falling
down. Everything is okay. Let's just test it
with APC, right? Can see shoot on here and
everything is collapsing, cool. Look at this one. You see some parts it's up in the sky with base can see it. We show it better like
this, you can see it. That doesn't look good.
It is in the sky. What we can do about it, we should create a
logic for destroying all the anchor
fields that are up in a sky without any column
connected to it, right? But just with that, you can see how it
is looking like, right? So let's shoot. It's fun to work
with it like this, but we will fix all
of this problem. If you shoot over here,
you can see this is in the sky without any
base to be on it, right? Let's see
what we can fix.
49. 45 Explain smart projectile: No one problem that we have is the way that we are
destroying or building. So, for example, let's
say we destroy this one, right, and we destroy
this one as well, right? We head over here. So what will happen this
field will be destroyed. This field will be destroyed, but the two field
won't be destroyed. This two field that is
protecting this window, is based on these
columns, right? So whenever these two
columns get to be destroyed, we should destroy these
two as well, right? So if we hit this column, we want to say, if
there is any field, anchor field close to it
and overlapping with it, try to destroy that if it
is above its position. For example, the position
of this one is here. So if we had here, we want to check if there is a field that is overlapping
with this field, and the height of it was higher, it means we need to destroy
this one and go up. We need to destroy
this one as well, because it is connected to this, and it is based on this, the ground that this metal is based on is this
column, right? So if we destroy this column, this part should be destroyed. This field over here
should be destroyed. This field should be destroyed, right, so it looks more natural. And for doing that, we can't just do it with
this projectile. I don't want to change
this projectile. That's why I want to go to
APC blueprint and control D to duplicate this to
create another projectile. And I want to call it APC
smart projectile, right? No, with that, we can
just close this one. I want to use this smart one. And in this smart one, I don't want to spawn the
destroy field like this at all. I don't want to do this. I don't want to do all of this. What I want to do after
span the sound at location, I want to destroy this,
right? Destroy actor. That's it. With this, if we use it, let
me go to the APC. Whenever we are firing our
weapon, let me find it. We Zoom, this is fire. We want to spawn the
smart one, right? BPAPC smart projectile.
No with that done. The difference is that
it apply some power, some explosion field, and after
that, it will trigger it. After that, it will have some sound and niagara
system, right? It won't destroy any anchor
field. So let me run. And if you shoot in
here, you can see, it's destroying a
little bit of building, and it's not destroying the
whole anchor field, right? The anchor field, how
we want to destroy it, we want to destroy
it in a smart way. So whenever we shoot at
the bottom of this column, all of the top part, either it is in
Anchor field or not, we want it to be
destroyed as well.
50. 46 Apply destructable damage: Know, in aerial engine, we have a couple of
ways that we can apply damage to something
to decrease itself, to destroy it, or
whatever, right? One of them is apply damage. One of them is apply
radial damage. No, we want to create
our own damage system. So I can just call
it damage building, damage destructible
or something, right? So for doing that, I
need to use interfaces. Why I want to use interfaces? Because our
destructible building knows about all the
component inside it, knows about all the
anchor field inside it, knows about all the geometry
collection inside it. So inside the building, we decide if they
hit us over here, what anchor field
should be destroyed. For example, if
we hit over here, this anchor field
should be destroyed, and this top part anchor field should
be destroyed as well, because this one and this one and this one is
based on this column. And if there is no column, those should go down
as well, right? So we want to do it inside
or destructible building. But how we can let the destructible building know that we are hitting it, right? There is lots of way, but the easiest
way is interfaces. For doing that, go
to content drawer. I want to go to destruction
folder, go to Blueprint. And in here, right click, go
to Blueprint and in here, create a blueprint interface. And I want to call it BPI
for Blueprint interface. Destrucb destructible, right? BPI destructible. And inside it, I want
to create a function apply destructb damage, okay? Apply destructible damage. And for the input of it, I want to get where
it did hit, right? So I want to call this
one hit location, and the type of it, as you know, it
should be vector. To tell building tell our destructible building
where we did headed, right? Let's just head compile, save. And now we should go to
destructible building, go to class setting. And in here inside interfaces, click on at and I want to search for BPI Destructb, right? With adding that in here, you can see inside the
interfaces over here, we have applied
destructible damage. Double click on it, and now
you can see it did create a event for us inside or destructible building
blueprint event graph, right? In here for just testing it, I want to use a print string. And I want to say destructible
damage, right? That's it. Let's just put it over here. And no with that done. Let's just compile. We want to test if it
is working, right? We have a event that we
created with our interfaces. Let's see how we can call it. For calling it, I want to
go to a Smart projectile. And in here, you can see
this event hit gives us the other blueprint
or actor that we are hitting that it
caused us to stop, right? And inside that,
we can check if it has apply destructible damage.
We can check that, right? That's if it has it, it will run it, but if
it doesn't have it, it won't run it at all. It will ignore it, right? It need execution pin. So let's just put it before
this spawn FS field, hold control to gravel of this, put it over here, and
connect it like this. It needs a head location. We can get the impact point over here and pass it
to the head location. Know with that if this smart
projectile hit anything, this will check if it has applied destructible
damage event inside it. If it has it, it will pass the impact point as
its head location. So with that, we know the
location that we hit, right? No, let's just head compile
and run, no let's just shoot. You can see it says
destructible damage. And for you to see that this head location
is working as well, let's just go to
destructible building. Instead of just using prints
sring what I want to do, I want to use the bake draw, for example, a sphere, right? And I want to
change the color of it to red for the location. We can use this head location. For the radius, let's just
use 120 for no, right? And the duration, let's just say five second
and the thickness, let's just say ten so
you can see it better. Head compile. I know if we go to our level and run
wherever we head, you can see that red
sphere will appear. So no overbuilding knows
where we are heading, where we are trying to
apply destructible damage. That's it. We want to use.
51. 47 Find touched anchor fields Part01: No, with the interface
that we create, we know where exactly
we are hitting, right? With this inside our building, we know where exactly the projectile head
or building, right? I want to see what anchor
fields it did touch. For doing that, I want to
create some variables. So in here, create a variable, and I want to call it
touched anchor fields. And the type of it, I want to change it to
primitive component, the object reference, right? Go down, touched. Why primitive component
because any of these anchor fields is just some primitive
component, right? No, with that, I want to change the category
of these two. Let's say, destructible, right? Just create a category for it. And I can collapse everything
else because there is lots of them in
here. And that's it. These two GC and anchors, it's for setup, right? So add a category for
these two as well, and you can just drag
and drop the two here. This two was for setup, but this touched anchor
field is important for us. First thing that we want to do with this touched
anchor field, we want to change
it to array because our projectile can hit
multiple anchor field at once. So for saving all of
them, we need array. So click on it and go to value type and change it
from single to array, right? First thing that we want to do, we want to grab this
touched anchor field, get it, and clear it. Okay? Just say clear on it. So if there is anything
in it from before, because we can hit multiple
time on our building. So we clear it every
time that we got hit, we got apply destructible
damage, right? Know with that, I want
to create a function for checking whichever anchor field we are touching or
overlapping, right? So for doing that, I will go to function and
create a function. And I want to call
it find, touched, anchor field and that's it. This is our function. Let's
just use it over here. Like this, grab it, put it over here, and no, let's just double click on it. As it's input, I want to create a input of type of vector. So click in here,
change it to vector, and we should know the location
that the projectile hit. So we need to pass it. I want to call it
hit location, right. And with that done,
I want to use a multi race multi trace, multi sphere trace by channel. With that, we want to check
what or projectile touched. For the start and end, I want to use the head location, and for the radius, I want to use 120. You can decide what
is your radius, explode radius as well, and for you to see
it, I want to change the draw debug type for duration and duration
by default is five. W that there, we don't need
this draw debug sphere. We can just delete it and
connect these two here. No, with this function, we need to pass the head
location to it, right? Like this, pass the
head location to it. Now, if you run over game, let's just go to
our level and run our game and shoot over here, you can see it will show you where it's atting
or building exactly. Those green squares, it will show you all
the information. You can see green squares, it will tell us to where what location we are
heating the stuff, right? And if you should,
you can see it. Now, we are using multi sphere trace by channel inside this
function, right? But not all of the things
that this is heating, we want to destroy, right? We want to just
check for fields. This is fine touch
anchor fields. So we don't need everything. We need just the fields. So we should check if
it is field, right? So for doing that, we can use for each loop on this array. So search for each loop. And each time it will give us a new object that it
is hitting, right? And we can get that hit
result and break it. If we go down, we can
break the hit result. No, this will give us
the component as well. This component is
really important. So for you to see it that, I want to use a
printer ringing here. Print a string and show
this head component. Let's see what will give us, how we can find out if
this multi sphere trace by channel if it is hitting anchor fields or
not, which just compile
52. 47 Find touched anchor fields Part02: Go to our level and run over game and shoot. No, you can see. It says, at some point, it shows us some stuff, but it's going away. So let me go here and change it the duration to 20,
for example, right? Now, with that,
again, head compile and go to our level
and run over game. No, let's just You can see we have anchor field generic 11, 391, 390, and 380. And it's three of them, we are hitting just
with this, right? You can see it over here. No, with that done,
let's just go here. Instead of saying
get display name, I want to use something else. I want to say get
object name, right? This get object name, it's easier to work with. Now, let's just
show that, right? If we had compile no, and no, let's just
run over game. If we shoot over
here, you can see, it's a sphere sphere
volume column. Box collision. If we head here, you can see there we are
hitting like four or five, and you can see it
says box collision. What is this box collision?
Let me show it to you. If you open up the anchor field, let's just go to Asset fields and open up the anchor field, there is a box
collision in here. Let me find it. There is a box
collision in here. And where multi sphere
trace is finding this, let me rename it
to something else so you make sure
that it is working. Let's just call it box
collision, anchor. Field, right? Box
collision anchor field. And no let's just head compile and no go to level
and run over game. I know if you shoot
where it says, Box collision anchor field. So with this box
collision that is inside, we just comparing this name, we can find out if you are hitting an anchor
field or not. Right? So for doing that, we can use this get
object name and check it if it is
equal exactly two. Let me copy it from over ankle field generic,
this one, right? Head of two to rename
it, control S, copy its name, and paste
it over here, right? No, with the loop body, we want to use a branch
and connect this to here. If it has box collision
anchor field inside it, we know that it will go to true. And with that, we know that this component that we are hitting is just
a anchor field. And with that, we can add it
to our touched anchor field. So let's just grab or
touched anchor field, and with that, we can
add to it, right? What we can add to it can
add this health component. So let's connect it
like this to here. That's it. Now for you to see
it better at the complete whenever this for each loop goes through all these Ohads result, we want to use a printer string. So search for printer string. And let's just show
the anchor fields, get the anchor field touched
anchor fields, and in here, get the number or
length of them, right, and show it over here. That's it. Let's
just head compile. And now go to our level
and run over again. If we shoot in here, you can see it says Tree of the anchor field
you are hitting. If we had here, it will say you hit
two anchor field. Here, you can see it says
you hit two anchor field. And if you hit here,
you can see it says you hit one anchor field, and you can see it
one If we head here, you can hit multiple
one as well. You can see four, right? So, no, with this
logic that we have, we are saving
whatever anchor field that we are hitting with our projectile in radius of 120 inside this
touched anchor field. And at the complete at the end, we are showing the length of it. I don't want to do that.
That's just enough.
53. 48 Anchor field to be destroyed: Know what we have. We have
all the anchor fields that our explosion or
projectile is touching, right? And we did save it
inside a array, and we call it touched
anchor fields, right. So with that, what I want to do if you go to
our view port in here, let's say we are heading in
here, we're heading in here. So we touch this
one and we want to check if this one
touch other ones, this big anchor field is touching or overlapping
with other ones, destroy them as well. So this one should be destroyed, this one should be destroyed, this one, this one, this one, and this one should
be destroyed. This top one should
be destroyed because all of them are connected
to this column. Column in real world, if it's fall, whatever that is connected to it
should fall as well. So now let's see how
we can get those. For doing that, I want to
go back to our event graph. We have all the
touched anchor field, and we want to check. Whatever anchor field
that is overlapping with this touched anchor field should collapse as well and
should be destroyed. So for doing that, I want to duplicate this control
de duplicate it, and I want to call
it anchor fields. To be destroyed, right? Anchor field to be destroyed. So with this, we will save whatever anchor field
that we should destroy. So we want to check all of
these anchor field that or projectile touch and use a
forage loop on it, right? And with this, first of all, all of the touched
anchor field should be added to our anchor
field to be destroyed. So we get this and we add all of these
touched anchor field one by one to this one. And this time, I want
to use add Unique and connect these to here and connect the anchor
field to here. With this, whatever anchor
field that we saved in here, we will save it inside the anchor field to
be destroyed as well. But what is the difference
between add Unique and add? What is the difference
between them? This add unique check if this, for example, anchor
field that you want to add is already there or not. If it's already there, it
won't add it multiple time. So it will prevent
some bugs, right? It will just add it once. So know what we want
to do after this. Each one of these anchor fields that this forage loop will give us each one of
them one by one. We want to check those to see what anchor field it's
overlapping with. So we can get overlapping
components, right? Again, this will
give us an array of all the anchor fields
that is overlapping with the anchor field that we did touch with or
projectile, right? If we go to Viewport, let's say we hit this anchor field we get
overlapped component, it will give us
this one, this one, this one, this one, this one, this one, and this one. Whatever anchor field that is overlapping with
this anchor field that we are checking it, right? So now, let's just go back
to event graph in here. We want to loop through all the overlapping component with all the touched
anchor fields and again, loop through them for each loop. Right, give it the
execution pin. And we should check
first its object name, get object name to see if
it is anchor field or not. How we find it in find
touched anchor field, we check if the object name was box collision anchor field. It means it is a
anchor field, right? So let's just go back here. We want to check
if this is equal exactly to the box collision
anchor field, right? We can check it
with a branch like this and connect the
loop body to it, right? It is it, it means this overlapped component
is a anchor field, right? So we can save it in anchor
field to be destroyed. So in here, we get it and add it to it at unique
this time as well like this at this one because
it is anchor field that is overlapping with
the anchor field that we touched, right? I know it's a
little bit complex. You should watch it multiple
time and think about it. It's really hard
challenge after that, I want to add it to the touched anchor field,
as well, okay? Like this, add Unique as well, so it won't add
it multiple time. Which one? The one that is overlapping with the
touched anchor field, right? Connected like this. Now with that done what will happen inside this
anchor field to be destroyed will be saved whatever that is overlapping with this anchor field
that we are hitting. So if you hit this one, it will save this anchor
field, this anchor field, this anchor field,
and this anchor field inside anchor field to be
destroyed that is in here. Anchor field to be destroyed. No, we can destroy it, right? Let's first see how
we can destroy it. And after that, we will
add more cool logic to it. But before doing that,
because this event hit can have multiple
time on our building, that's why we need to clear every time this anchor
field to be destroyed. Like we clear touched
anchor field, right? We should clear it in here. So search for clear, connect execution, pin to it. And know with that, next video, I will show you how you
can loop through all of these anchor fields to be destroyed and destroy
them one by one. Let see we can do that next
54. 49 Destroy all overlapped anchor fields: Last with what we have done. Let me explain it one
more time because I know it's getting
really complex. In here, we get all the touched anchor
field with or projectile. And for each one of them, we check whatever
anchor field that is overlapping with those
anchor fields, and we check. If it is anchor field, we save it to be
destroyed, right? Inside this anchor field
to be destroyed, right? Now, we want to see
how we can destroy it. In here, whenever this
complete happened, it means we did save all the anchor fields that we touched with
our projectile and all the anchor fields
that is overlapping with those touched anchor field with the projectile inside the anchor field to
be destroyed, right? So in this complete everything to be destroyed will be
saved in here, right? So we can use for each loop
in here, for each loop, and this anchor field
to be destroyed, anchor field to be destroyed, connected over here, and
no, we can destroy it. And how we can destroy
it, if you remember, in our projectile, we did
use FS destroy Anchor field. So what we want to do for each one of these anchor
field to be destroyed, we just spawn a
actor from a class, and the class is FS
Destroy Anchor field. And for the spawn transform, we can get the word transform of or anchor field that
should be destroyed, right? And after this, we
want to trigger this. If you remember we should say S trigger, S trigger, right? Now with that done, if we head compile and go
to our level and test that, if we shoot down here, you can see all the anchor
fields are being destroyed. If we shot here, you can see nothing
will stay in the sky. Everything is connected
to something. Then if you shoot in here, every anchor field
will be destroyed. Nothing will stay on no
base, no ground, right? Everything looks much better. Shoot in here. Again,
you can see good. We don't need this multi
sphere visualization when we shoot something.
We don't need it. So let's just go to find
touched anchor field. We had a multi sphere
traced by channel, let's just change the
drawib type to none, so it will be more clean to
shoot at the stuff, right? At compile, go to level and run over game and shoot in here. Now, you can see, everything is destroying correctly.
Shoot over here. Again, everything is
destroying correctly. But let me show you a problem. If we run over game, and let's say we hit
middle over here, right? You can see it's destroying
all the columns, right? This is not okay.
55. 50 Make destruction more real: Now let's see how we can
fix this problem that whenever we hit a
small anchor field, it will destroy everything. So let me run and you can see if I
shoot at middle of this. It will destroy everything. It shouldn't be like that. First thing that we should do, we should decrease the
radius of our explosion, and how we can do that in
find touch anchor point. It's 120 and it's too much. If we put it on 20, let's see what will happen
if we had compile. And let's just go here and run. Now, if you shoot at middle, you can see, again, we are shooting at middle, but it's destroying everything, the column as well. Let's just test
that one more time. If we shoot up here, you can see this
time is working. But let's just test This one
is working. That's good. All of a sudden, everything is working, but it
shouldn't work. So let's just shoot at this one. You see, we are
shooting at the window, but it's destroying everything. That shouldn't be happening. So how we can fix this, we should find out
what you are hitting. If you are hitting a column, destroy everything. That's okay. But if you are not
hitting a column, just destroy that
anchor field, right? So for doing that, I want to
go to our building in here, go to event graph in here. And after we found all of
the touched anchor field, let me make some space in here. I want to create
another function to check if you are hitting
column or something else. So for doing that, I want
to create another function, and I want to call it
find anchor field. That was hit. Okay, or whatever
you want to call it. Just with this, I want to loop through all of the
touched anchor field, loop through them with each loop and connect the execution
pinto it, right? Now, we are looping through
all the anchor field, that or projectile or
explosion hit, right? And with it, I want
to check the scale. If we go to Vewport, you can see the columns has a bigger scale
in Z direction. But other anchor fields, you can see the Z a
scale of it is less. In here, Z scale of it is 0.5. Again, if you go here, you can see the Z
scale of it is three. The columns, the Z scale
of it is a lot, right? So with that, we
can find out if you are hitting a column or not. So let's just go back in here. We want to get the word, get word a scale of it, right? And we want to check just the Z. So we can right click in
here, split the stroke pin, and we want to check
if it is more than, for example, let's say five. It means we are hitting column. Let's check it with the branch. And with that, let's connect
the execution pin to it. If the Z scale of it
is more than five, it means we are
hitting column, right? So this true will happen, and in that case, we want to return the function
with that anchor field, and how we can do that, we
can just dig and drop this. So to create it and return
it as output, right? I will create an
output automatically, and we can tell it main anchor
field that was hit, right? If it is false, we
don't do anything, we will go to the next element, next anchor point, right? If this finished and we didn't return any anchor
field to be destroyed, this complete will happen. And in this case, we want to return one of these
touched anchor field. So grab it controversy Control V and get a
copy of one of them. Which one the zero? That is the first thing that or projectile found touched, right? And we can pass that, right? Just with that, let's just
head compile and go to our event graph and use this
function that we create. Find anchor field that was hit with that's
connected like this. And connect this to here. I want to promote this to a
variable first like this. And let's just change the
category of it to destructible, so it will be easier to find it. Main actor field that was hit, right, and connect the
execution, pin to it. And after that, let
me make some space. After that, we want to check
if it is valid or not. So it is valid. And if it is valid, we go and try to destroy everything or
just one thing, right? Now with that done. Before destroying everything,
you know that with this, we will destroy all
the anchor fields that should be destroyed, right? But before doing that, we need to check
something with a branch. What we want to check, we want to check if
this main anchor field that was hit was
a column or not. Right? How we can find
that out, it's easy. We can just get it over here, main anchor, field that was hit. And with that, we can get the word scale of it and
right click on this scale, split a stroke, pin. Again, we want to check if
the Z scale of it was bigger than five it means we
are hitting column. In that case, you can
destroy everything. But if we didn't hit the column, these falls will happen. And in this case, again, we want to destroy
something, right? But in this case,
we want to destroy just the anchor
field that we hit. So select these three
and control C Control V to paste it over here
in case of falls. We want to just destroy the main anchor
field that we hit, the anchor field that we hit, that is not a column, right? Just with that, let's
just head compile and no go to our level if
you run over game, and for example,
let's over here. You can see it will
destroy some anchor field, but it won't destroy
everything you shoot in here. It will destroy something,
but not everything. But if we hit the column, you can see everything
will be collapsed. If we hit the roof, you can see what will happen. But if we hit the column,
everything will collapse. If we hit the column,
everything will collapse. In here, you shoot in here, it will destroy
something, right. Yet in here, it will
destroy something. But if we hit the column, it will destroy
everything that is based on this column.
That looks awesome.
56. 51 APC Engine sound: Know that we are destroying
our building correctly. I want to add some sound to
APC for its engine, right? Make sure before doing
that, you save everything. And after that, go
to Content drawer. Let's just open up
the APC folder, AP BP APC, right. What I want to do, I want
to add some sound, right? But what we want to add, let's just go back
in here, right, click in here,
create a new folder, and I want to call
it audio, right? And in here, right click, go to audio and create
a metasund source. I want to call it
s engine, right? Do I click on it to open it. In here, we want to play
a wave player, right. Use a wave player Mono is more than enough connected to
Otwood so we can hear it. The wave asset that you want
to play is engine idle, and we want it to be on loop. That's it. Make sure you
save it and close it. No inside or BPA PC. I want to click on or mesh, click on AD and add
a audio, right? And I want to call it engine
audio or engine, right? The audio that you want to
play is called Ms engine. Of course, I didn't
call it right, so let's just go
here, call it right. It should be like this,
right? So that's good. Now, with that, if we go to
our level and run over game, you can see there is
some sound in here. But if we move, you can see the engine sound is
not changing at all. That is a problem. What do
you want to do to fix that, we want to change the pitch of sound or audio engine
sound based on the speed or velocity
of APC, right? So for doing that, I will get over engine audio, and in here, I want to set pitch multiplier to
change the pitch of it on every tick, right? And how I want to change that, I want to get the velocity, the velocity of APC, and I want to get
the length of it. So search for vector
length XY, right? And based on this
speed or velocity, we want to change the pitch. How we want to do
that, we want to map it map range clamp. So for example, we say, if the SPD is zero, give me a value of one on
output as the pitch like this. But if the speed or
velocity is 5,000, give me a value of
tree for the pitch. That's it. You can play with this value until you reach
the result that you want. But if you run with
him and move, no, you can see the engine
sound sound. Much better. And if you starting here, no, you can see beat and thet Cool. That looks awesome. We did create really good
game, congratulations.