Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire …

收藏待读

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire …

Today we』re going to start working on the 3 rd and final power-up for the cube flyer series: the invincible power-up!

The invincible power-up will speed the player and make them immune to any damage that they』ll take.

At this point, we would be beating a dead horse with just adding an asset, to spice things up a bit, we』re going to find another asset and combine it with a particle effect.

Here』s today』s plan of action:

  1. Find a rocket model for our invincible power-up
  2. Create a fire particle effect for the rocket thrusters

We』ve been doing more and more things with the particle effects, but today will be one of the more involved things that we have yet to do with particle effects!

Step 1: Add a Rocket Model to Unity

Step 1.1: Find a rocket model to use

At this point, we already know the drill, let』s find a free rocket that we can use online. I went to free3d.com to look for any rocket model to use.

Here I found a rocket that we could use. It』s called Rocket V1

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Step 1.2: Adding the model to Unity

Download the model. It』ll appear in a zip folder. Once you unzip it, there will be 3 files, we only care about 2 files:

  1. .obj – the model to be used
  2. .jpg – the texture we will use for our model

I renamed both files to be called rocket (for consistencies) and then dragged it to our Unity project.

Now that we have imported the asset into the game, let』s use it!

  1. Drag the obj into our scene
  2. Drag our jpg onto our rocket game object.

Here』s what we have now:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

As you can see, the rocket is gigantic, but we』ll fix this later.

Note:I already adjusted the rotation of the rocket to be facing upward, normally it』d be facing horizontally.

Step 2: Creating A Fire Particle Effect

Step 2.1: Making the fire particle effect

To make a fire effect I watched a couple of tutorials on making a fire, out all of them, I really liked: Unity VFX Tutorials – 08 – Basics (Fire)

It showed you step by step to make a fire effect. There were a lot of good information that I won』t use for creating our own fire (we could just take the prefab that the tutorial provided us), but there were a couple of interesting things I learned:

  1. All we really need for the particle system is a texture/material, a lot of the take is used to make a particle is already handled by the particle effect system by itself.
  2. We can achieve more complex particle effects by combining multiple particle systems together like shown here in the video
  3. And overall a lot of ways we can use the particle system such as changing the colors and the alha to get a fading away effect

It』s a 20-minute video, if you』re even remotely interested in seeing how to make a particle system, I recommend checking it out!

Nonetheless, let』s get started in re-creating the particle effect shown in the YouTube video, I』m only interested in creating one fire particle effect so I』m going to omit the rest.

  1. Download the unity package from the YouTube video above
  2. Import everything from the package into our Unity workspace, everything should be in the folder 4_Fire
  3. We』re only interested in the TXT_Fire_01 Texture, if you look at it, looks only white and that』s because the image itself is white with a transparent background (which is also white)
  4. Let』s create a new material called Fire inside our Material folder
  5. For our Fire material, set our shader to be Partices > Additive
  6. The set our Particle Texture to be TXT_Fire_01

When we』re done our Fire material will look like this:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Notice that we can see the texture shape now?

We』re going to be using this material for our particle system and it』s going to generate this texture affect for us, and because we create a lot of particles, you won』t ever notice that our fire is being made by these 4 little shapes.

Here』s what I mean:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Now let』s make our particle system.

  1. In the game hierarchy, create a new Particle System and call it Fire Particle

We』re going to make a large set of changes now, most of this will be take directly from the YouTube video.

  1. Start Lifetime: 1.2 –how long each particle will live
  2. Start Speed: 2 – how fast each particle will move
  3. Start Size: 1.75 – how large each particle will be
  4. Start Rotation: a range from -45 to 45 – randomly rotate the particle with the given angle
  5. Start Color: FFDDBD – the color of the particle

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Now with these base settings, we want to go to the Shape tab, from there change the value:

  1. Angle: 5 – how spread out will the particle come from
  2. Radius: 0.1 – the shape we are using is a cone and the radius decides the size of where the particles come out from

Next up in the Color over Lifetime tab :

We want to choose a gradient of color, here』s what it looks like for a better visual understanding of the colors over time.

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

To summarize, the top arrows are used to control the opacity (0 is clear, 255 is solid) and the bottom arrow controls the colors.,

  1. For the Color we want to use the fire color, which consist of a yellowish color of FEFF00 and a redish color of FF3600 , try to match what I have above and feel free to play around with the color!

After colors we have Size over Lifetime , which changes the particle size over time.

  1. Here』s what we want, basically we just want to make our fire start at a 5 size and end at 1

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Next up is Texture Sheet Animation , this will allow us to play through an animation from the texture that we provided. The texture we use can cleanly be sliced into a 2×2 grid, we』ll be animating through each of the fire shapes in the texture.

  1. Change Tiles to be: X:2 Y:2 – This defines the size of the grid we want to subdivide the texture to be in

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Here』s what 2×2 looks like:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

And here』s what 2×1 looks like:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

With 2×2 we』ll be animating through all 4 of our sections in our texture.

Finally, we』ll be going to Renderer to add our material in

  1. In the Material slot add Fire

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

After all of this, we should have something like this:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

Step 2.2: Adding the fire particle effect to the rocket

Now that we have our thruster particle it』s time to add it to our rocket! We』re going to need to do some scaling around to make the rocket the same size as our other power-ups and we must scale our fire effect to match it.

  1. For the rocket we want to change the scale to be (0.015, 0.015, 0.015) and change the Rotation to be (270, 0, 0) , which will make the rocket face upwards.
  2. For the Fire Particle make it a child of rocket and then change the scale to be (0.5, 0.5, 0.5) , the rotation to be (180, 0, 0) and the position to be (-45, 0, -550)

After all of that we will have something that looks like this:

Day 93 of 100 Days of VR: Endless Flyer – Creating the Invincible Power-Up Asset with Fire ...

End Day 93

And there we have it, we have it, our final power-up! This wasn』t a simple grab drag and drop post now was it!

In the end we probably could have just used the prefab from the YouTube video, but I』ve certainly learned a lot going through all the settings and then playing around with them and hopefully you guys have too!

Next up in our series, we』ll be adding the power-up into our game!

原文 : Coding Chronicles

相關閱讀

免责声明:本文内容来源于Coding Chronicles,已注明原文出处和链接,文章观点不代表立场,如若侵犯到您的权益,或涉不实谣言,敬请向我们提出检举。