All language subtitles for 2. Tank Projectiles (GOOD)

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

Let's discuss about tank projectors and when discussing about tank projectors, there are two parts

involved.

The first one is, of course, the projector.

The second one is the means of creating and firing.

The projectors were in game terms, the weapon system.

Let's look at the three different projectile types present in this project.

So the projectors that we are going to look at are the main projectile, which is a linear projectile.

It moves straight forward.

We're going to look at the rocket, which has a different trajectory and an ARC projectile, which is

basically a cannonball which moves up and then comes down in an arc.

Each projectile has, as you probably noticed, it's on scene with its own parameters, objects and

scripts.

Let's get started with projectile one.

And as you can see here, right out of the bat, all the projectiles kind of have the same scene structure.

So once you go through one, you will understand for all of them, what does it have here?

Of course it has the projectile model, which is just the 3D object.

This one I created in Blender.

But in the rocket case, I created ingot directly.

We also have a timer.

This is just the good old timer that acts as the timespan of the projectile.

We do need this because in the case that the projectile hasn't collided with anything and has exited

the main scene, so that means that the projectile is still around, but it cannot ever go away.

We need to kill it at some point.

And the kill time is 2 seconds.

We also have a trail which is a component from the trail system.

This is a very nice plugin which I recommend for good though this makes awesome trails and the collision,

which is an error collision.

And here we have a collision shape which should match our project.

Elephants are critical, to be precise.

Here I want to point out that the collision here, the collision layer doesn't matter so much because

we don't really want the projectile colliding with themselves, but we want the masks to be one and

two because on the one, we have the tanks and on two, we have the buildings.

So the mask is what the projectile interacts with.

So this is what we actually need from it.

So let's look at the code.

This is the projectile code.

What we have here is, of course, the speed and damage and these values are exported so we can change

them at project level.

So this is quite neat functionality.

We have the process functionality and this is the easiest one for this projectile because once the projectile

is enabled because if it's if it's not enabled, then it will just return.

So nothing will happen.

We just translate it forward using the current speed and the delta, which is the time between frames

so that this is frame rate adjusted.

It don't move at different speeds.

If you have 120 frames per second or 60 frames per second, the initialize function is probably the

biggest one.

And one important thing that I want to note here is the fact that these parameters and this method is

the same for every single projectile.

And this is important because if we keep the same header in the same parameters, then we can just stop

the projectiles in and out.

And we don't have to put more code to handle each projectile type because as you'll see here, some

parameters like the target point is not actually used for this projectile and in other cases it will

be used.

But you'll see when the projectile gets called, it's just one line in the tool or for every projectile.

So in this case, we need some parameters that might not be used by one or another projectile.

What we have here is the start point, which tells where the projectile should start from the target

point, which is actually not that important for a projectile that moves indefinitely forward.

This is more for projectile that target, the specific position, the damage of the projectile, the

color which is mostly the color of the parent, the parent tank object, which is basically needed to

detect collisions and basically avoid collisions with the parent and the parent script which has specific

functionality just for ARC projectiles.

So this won't be used in this one as well.

So first we need to set up the rotation.

So this is how we set up the projectile rotation to the five point rotation from the tank.

Then we set up the position.

So as you see, the start point is basically just the transform that contains the rotation and position.

This is enabled.

It happens here because if we don't put this, then when we instantiate the projectile and it initially

gets instantiated, that position 000, I think we don't want the projectile to actually start moving

from that point.

We want the project to start moving once it gets the right position.

So we first set up the right position, which should be the tip of the tank start, and then we enable

it so that it moves from that position.

We also set the time span to start and we also need to change the color of the project.

And here you'll see a familiar code if you checked the other tutorials.

So we need to get the current material duplicated because otherwise we will change all the projectiles.

And you don't want to change all the color just only for this one.

And then we basically set it back to the same object.

You see, this is basically the same line.

So we take the material duplicated and then set it back and then change its color.

This will make sure that just this particular instance of the projectile gets its color changed.

And there is another way to do this.

I want to quickly mention, but I will not be using that way.

So for example, if you have a material, if you select this material, you can put in resource and

local to scene.

This will actually, in theory, work all the time to make this material local.

I tried it for some particular cases.

It might not work, I might be wrong, but I'll be using the duplicate because that's like 100% sure

that it's going to work.

But this isn't the way to do it.

I just want to mention it.

So going back to the code, Leslie, we have a twin.

And this twin basically just interprets the speed to not have the maximum speed from the beginning,

to just have a small transition from the current speed.

So the speed the maximum speed is ten in this case, and the current speed will be transitioned from

zero to the maximum speed with a factor of 0.25.

Of course, if sine transition and is in and out.

So if you want your speed to be directly that fast, either just to move the current speed, then just

to speed here and to completely delay this, it don't matter.

Next, we have the time spend time out.

And as you can see, there is no code for this.

So how does this gets connected?

Well, is because I'm using the functionality from here.

So if you just click on the time spent timer and node and we see here a list of signals that this node

triggers when they happen and the time out happens when it when this timer reaches zero.

So I just used connect and then put on this script and the generated this function when the time speed

gets zero, then we free it from the memory.

So basically we kill it.

Next we have the on area body entered.

And this is important because the area can detect multiple collisions, but we actually just need to

detect the body collisions.

So for this, we go here and we use the body.

And third and of course, we do the same as the timer and this is what we end up with.

So what happens here?

First, we need to prevent the self collision.

So if the body that was detected is the same as with the parent, then we turn.

We don't care about it.

The next one, if the body has no system and if you have looked at the main pair functionality, you

know that HP system is right below the kinematic body and this would not have been possible by this.

Otherwise I would have to go up one level, actually go up two levels and then go to systems and then

go to system.

So this would have looked like so is kind of weird.

It's much easier to put it like this and it's much more clear.

Of course, if it does have this note, then we take it out and call take damage, which takes the projectile

damage is subtracted from the life and also it informs the object that took damage which object damaged

it.

So this is important for later when the enemy gets hit by the player and the enemy actually acquires

the target from that hit, not from its other sensors.

Next, we set up some nice effects and that is a small explosion and the camera shake.

And you can change these values to make it look more nicer.

And lastly, we need to destroy the projectile and we get this.

So if you run it, this is what you get.

The projectile instantiate an effect.

It's quite cool.

It's quite nice.

It nice.

You can change the values.

Like damage, like speed.

Time out, of course, to predict that once it leaves the space, it will actually die by itself.

So.

You see, it disappears.

So that's the time out.

That's when it disappears.

If you want your project not to disappear from the screen, there are two ways to do it.

Either you go to the maximum length and you try it like this and then you adjust the timeout.

The other one is completely remove the timeout and surround the scene with some colliders.

And basically you're assured that the projectile, even if it leaves the scene, it will eventually

collide with something and it will get destroyed.

So both are valid options.

You can pick whatever you want.

Now let's look at the Rocket project that.

And before we look at the in the rocket projectile, I'm going to quickly show you how you can actually

change projectors and then the player.

So I'm going into the player quickly and then to the weapon system.

And here, as you see, we have the projectile.

So if I just drag and drop.

The rocket projectile.

And then, of course, into Soviet and.

So this is the rocket projectile.

Its main difference than the regular one is that it actually aims for a particular target so it doesn't

move aimlessly towards infinity, but actually aims to a particular target.

And the other part is that it starts to the particular rotation and it tries to adjust that rotation

to eventually arrive at the target position.

So how does this happen?

Let's look now at the projectile rocket.

Join the projectile rocket.

We have the mesh, which is just the 3D model.

We have the collision shape.

And this was required because if we don't have it, then the kinematic body will complain.

But the actual collision shape that matters is in the area.

So here that we get sexually on by the entered similar as the other one we have also the time span and

the nice trail effect.

Let's look at the code now.

So here, as you see, the initialize is basically the same.

But the main difference is that we just put the origin position.

So we just put the initial position.

We don't put the rotation because the rotation actually is randomized.

So the project, I'll start with a random rotation and basically this twin is the same.

So it adjusts the speed to not be instantaneously fast from the beginning in the process, what's it's

different because it calculates a direction from the target point that we want to achieve to the point

that we are currently at.

So this is a vector of we need to get the length of it and then we normalize it to a length one.

And if the length of the vector is below two, then this means that the projectile is close to the target

and we can actually delete it.

But what makes the projectile work is actually we translate it to the direction multiplied with the

current speed and the delta.

So as I mentioned, the direction is a vector from the find the position that we want to achieve to

the position that we currently are at.

And we need to translate it slowly to the final position.

And of course, if we just use this, then the projectile will look kind of weird.

So I'm going to quickly.

Change this.

So I'm going to play this because it will be interesting that the projectile will still go at the destination,

but I don't know if you see it.

The projectile doesn't rotate correctly and basically this is what they look at does because they're

there.

This is basically a name that they came up with, takes the previous position.

So I'm going to show this is the tank and this is the position that we want to arrive at the end.

So the projectile will get fired, let's say, with this direction and needs to eventually go to this

position.

First the direction.

So from the target point to the projectile will be this one.

So this vector will actually make sure that every single frame, the projectile gets adjusted accordingly.

Now, to actually make sure that the projectile gets.

This kind of rotation.

Instead of this one.

Because this will look weird, right?

So we need to avoid making it like this and make it look like this.

So how can we do this?

Let's take another arc because it's easier to see.

So we take the previous position, which is this one.

And the current position.

Which is this one.

So these are the two positions.

So we have the current position minus the previous position.

And this will actually give us this small factor.

And using this small vector.

We actually look at.

So we use the mesh to look at this vector multiplied by ten, which will be this position.

So basically.

The projectile will look at.

So in this case, it will look at this position, dislocate this position.

This will look at this position and so on, so forth.

But it will make it look like it's moving the right way.

Basically, this is called the tangent, and this is basically a line that's tangent to a circle.

So I think there are other math operations too, to do this, but this is what they came up with and

it works nicely, but we need the previous position as well to make this work.

So basically this is how this projectile rotates nicely.

And of course, when the collision happens, then this code is the same as the one in the previous projectile.

It takes the collision with the parent.

It checks if it has an HP system.

And if it does, then it takes damage.

And also it has explosion and the shake camera.

By the way, this value could have been exported nicely so that it could have been changed like at the

inspector level.

But you can do this in your own project.

Now, let's set up the last projectile to the player and see how this works.

So an important thing is not only that.

The projectiles have the same initialize function.

It's also important that with the same function they like pointing to the right target.

It makes the projectiles work in any case.

So this projectile, as you see it, forms an arc so it can go over buildings or over obstacles.

So this is more for an artillery purposed object.

So how does this work?

Well, let's look into it right now.

So the ARC projectile has the same functionalities as the one before, with the exception that the damage

area is actually a sphere.

And mostly the artillery projectiles do splash damage.

So you can increase the sphere size if that's what you want.

Now let's look at the code and here in the initialize I said, does the same for everyone.

We need to set up the position and the rotation to the correct ones from the fire point.

And then we do the arc calculation.

And basically what this does is actually broken down into two parts.

First, we calculate a vector.

That is how much force we need to apply to this projectile in order to arrive at the correct final destination

where our mouse cursor pointed that.

And the second one, we actually need to apply this to the physics enabled object.

And as you can see, this object is actually the only projectile that has a rigid body and this is really

needed because otherwise we cannot make it work.

First we need the arc height and we calculate the velocity.

And the velocity, as I mentioned, is a vector that actually stores how much power we need to apply

in order to arrive at the correct destination.

ARC velocity gets the position, it gets the final position, it gets the arc height, which is the

actual height of the arc, how much we want it to go up and then the gravity and you'll see here some

small values that they modified.

And this is because the initial values didn't work properly.

So I had to adjust them a little to make sure that it reaches the correct destination.

And then the arc velocity.

Basically, we calculate the velocity using a displacement.

So here's some math involved, but the end result is basically a vector that has three components and

the final two still needs some, some little adjustments.

So we do need to modify the up vectoring and then the X and Y and Z one, and this will assure that

the arc nicely arrives at the destination.

So once this happens, the last thing we do is add the central force, which is the final velocity.

We also set up the material for this projectile to reflect the color of the parent and the damage is

similar to the previous one.

The only difference here is that if the body doesn't have an HP system, then it's most likely a building

or it's an empty space.

So if this happens and this code is called, so what this does, it gets the reference to the parent

script and then it calls this on Projectile Miss.

And this is important for the tank that handles artillery because for example, if it goes behind a

big building, let's say this one, because it can position itself here.

And when it starts firing, oh, it it always goes into the building.

So this is how it knows.

Oh, I'm fine here.

The building is not hitting anything, so it will adjust position.

Still fire the building just position again, still far the building just again until eventually it

goes past the building.

So this is how this artillery tank unit gets information about if the projectile hit the correct target

or not.

This is important for just this projectile and the time span, which is similar to every other projectile.

This is the last projectile.

I hope you enjoyed this section.

I'm going to change the projectile of the player.

Back to the projectile one.

By the way, this is how you can change the projectiles for the enemy as well.

Next, they're going to other parts of the project.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.