Unity 2018 - Game VFX - Projectile/Bullet Raycast Tutorial
Вставка
- Опубліковано 20 вер 2024
- Unity 2018 - Game VFX - Projectile Muzzle Impact Raycast Tutorial
This video shows you how to create a Projectile, Muzzle Flash and a Impact effect in Unity. We use Photoshop and Blender to create our elements and create some code, with raycasts, for the projectiles to move and rotate in the right direction!
NEW Arrow Projectile Tutorial: • Unity VFX Graph - Arro...
NEW Fireball Projectile Tutorial: • EASY PROJECTILE in UNI...
Shoot Projectiles in a FPS: • Unity Tutorial - Shoot...
Here's a timeline:
01:10 Projectile VFX;
02:00 Projectile Mesh;
05:20 Projectile Texture;
07:46 Improve Projectile vfx / Add Trail;
09:55 Spawn Projectiles Script;
11:41 Projectile Move Script;
12:45 Rotate To Mouse Script (Raycast);
17:33 Improve Spawn Projectiles Script;
21:00 Muzzle VFX;
22:28 Muzzle Mesh;
24:43 Muzzle Texture;
26:33 Impact/Hit VFX;
27:49 Improve Projectile Move Script;
31:54 Conclusion
----------------------------------------------
DOWNLOAD HERE: / 20996029
OR
HERE: www.gabrielagu...
-----------------------------------------------
Courses
✦VFX GRAPH - BEGINNER: www.udemy.com/...
✦VFX GRAPH - INTERMEDIATE: www.udemy.com/...
✦VFX FOR GAMES - BEGINNER: www.udemy.com/...
✦VFX STYLIZED EXPLOSION: www.udemy.com/...
VFX Assets Packages
Unique Projectiles Vol 1: assetstore.uni...
Unique Projectiles Vol 2: assetstore.uni...
Unique Projectiles Vol 3: assetstore.uni...
VFX Graph - Mega Pack - Vol 1: assetstore.uni...
VFX Graph - Mega Pack - Vol 2: assetstore.uni...
VFX Graph - Mega Pack - Vol 3: assetstore.uni...
VFX Graph Tutorials
VFX Graph - Magic Orb: • Unity VFX Graph - Magi...
VFX Graph - Weapon Effects: • Unity VFX Graph - Weap...
VFX Graph - Portals: • Unity VFX Graph - Port...
VFX Graph - Loot Drop: • Unity VFX Graph - Loot...
VFX Graph - Lightning: • Unity VFX Graph - Ligh...
VFX Graph - Muzzle Flash: • Unity VFX Graph - Muzz...
VFX Graph - Hits N Impacts: • Unity VFX Graph - Hits...
VFX Graph - Heat Distortion: • Unity VFX Graph - Heat...
VFX Graph - Ice Attack: • Unity VFX Graph - Ice ...
VFX Graph - Stylized Fire: • Video
VFX Graph - Blood: • Unity VFX Graph - Bloo...
VFX Graph - Electricity: • Unity VFX Graph - Elec...
Shader Graph Tutorials
Shader Graph - Fire Flames: • Unity Shader Graph - F...
Shader Graph - Laser Beam: • Unity Shader Graph - L...
Shader Graph - Fire: • Unity Shader Graph - F...
Shader Graph - Tornado: • Unity Shader Graph - T...
Shader Graph - Blood: • Unity Shader Graph - B...
Shader Graph - Electricity: • Unity Shader Graph - E...
Shader Graph - Galaxy: • Unity Shader Graph - G...
Shader Graph - Black Hole: • Unity VFX & Shader Gra...
Shader Graph - Ground Cracks: • Unity VFX - Ground Cra...
Shader Graph - Ghosts: • HOW TO CREATE A GHOST ...
Shader Graph - Grow Shader: • Unity Shader Graph - G...
Shader Graph - Liquid Shader: • Unity Shader Graph - L...
Shader Graph - Glowing Crystals: • Unity Shader Graph - G...
Shader Graph - Clouds: • Unity Shader Graph - C...
Other VFX Videos
Projectile Raycast: • Unity 2018 - Game VFX ...
Weapon Trails: • Unity 2018 - Game VFX ...
Destroy / Explode Objects: • Unity 2018 - Game VFX ...
Loot Box: • HOW TO CREATE A LOOT B...
Valorant - Phoenix Fire Wall: • Valorant Phoenix Fire ...
Shoot Projectiles in FPS: • Unity Tutorial - Shoot...
Valorant - Sage's Wall: • Recreating Sage's Wall...
Doom Eternal - BFG-9000 VFX: • DOOM ETERNAL BFG-9000 ...
Demon's Souls - Disintegrate Enemies: • DEMON'S SOULS - DISINT...
Enjoy and feel free to ask any questions you may have, I'll answer as quickly as possible. And don't forget to like and subscribe. Thank you!
✦ Follow on TWITTER: / gabrielaguiarfx
✦ Like on FACEBOOK: / gabrielaguiarprod
✦ Subscribe On UA-cam: www.youtube.co...
Unity Particle System
Unity Bullet Effects
Unity Projectile
Spell Effects
Unity Spell
Unity VFX
Projectile
Fireball
#Unity
Spell
#VFX
#Raycast
*NEW Fireball Projectile* Tutorial: ua-cam.com/video/RsWw99JDXdY/v-deo.html
How To Shoot Projectiles in First Person (FPS): ua-cam.com/video/T5y7L1siFSY/v-deo.html
UDEMY COURSE - VFX FOR GAMES: www.udemy.com/course/visual-effects-for-games-in-unity-stylized-explosion/?couponCode=17.99_UNTIL_20-09
Unique Projectiles Vol.2: assetstore.unity.com/packages/vfx/particles/unique-projectiles-vol-2-156067?aid=1100l3Jhu
I just buy your course that so helpful for my project thanks you very very much
I really like that you explain how each topic is done (particles , 3d modeling, Uv mapping, Texturing etc..) It isn't something you see in many other tutorials.
Thank you. I'm glad to hear that!
Cheers!
Just a small tip for those following the tutorial. You can skip all that on spawn on the bullet it needs to get the mouse position rotation etc. Simply set the vfx.transform.rotation = firePoint.transform.rotation. The projectile will always have the same rotation as the the fire point and since the firepoint will move with the mouse position anyways, there is no need to add the extra steps of calculating the rotation.
We appreciate that you share your knowledge with us, though you ´re selling this stuff.
Totally agree!
People like them are called Heroes
@@jadrianmc3420 dude literally explained an asset off the asset store and made ppl pay for his monthly patreon wtf is heroic about it?
@@Ryan-xq3kl He could have just kept his process to himself, but he let people learn and make it themselves so they don't have to pay.
@@feistypug1 source-code patreon wall is some cuck shit
As a coder I want to point out some things:
1) Textures should be "in the power of two" - that means 2x2 4x4 512x512 1024x1024 and so on
2) a = Quaternion.Lerp(a,b,1) is the same as writing a = b , because lerp is a linear function where 0 (as time parameter) is "a" and 1 is "b"
3) In the projectile move Line Nr 16 at 12:17 you write x += a * (b*c) which is the exact same as x += a*b*c - you don't need brackets for multiplications
4) at 18:05 instead of using a function to pass the rotation, you could have just read it - the transform of the spawn point is rotated correctly, so at Instantiate(projectle, projectileSpawner.position, Quaternion.identity) you would just have to pass the rotation information too, like: Instantiate(projectle, projectileSpawner.position, projectileSpawner.rotation), no function call needed
5) Software Architecture: No one will search for the firerate inside the projectile, but instead, the firerate should be handled by the gun
also the gun holds the muzzle flash effects, so you don't have to create and destroy them every time a bullet spawns, also if anyone wants to spawn projectiles in their games, I highly recommend using Pools to avoid constant Instantiating and Destroying objects.
Overall, this video was still good, because it gave proper insights on the Art of projectiles, the graphic effects, textures, meshes and particle systems and I liked watching it (and gave it a thumbs up).
ur a god. you sell this, but also teach us how to make for ourselves. What a saint
I'm a beginner to unity and coding and this was super helpful!! I'm still lost but this helped!! Thank you!
Amazing work! Really appreciate how you are teaching us how to make these particles even though you are selling them!
I really only needed this video, but I bought your course on udemy just to support, Thank you!
You rock! Wish more people were like you. Thanks!
I gotta say, that you're awesome. From doing things to explaining stuff, you're just amazing.
Awesome tutorial.
I do most of my working unreal not really knowing any scripting being able to use the blueprints but I know a guy that was looking for a custom avatar in vrchat that was looking at putting some projectile stuff as particle effects.
not only did you make it very clear and how to begin setting this up you taught me some pretty cool tricks to use for creating ice particles thank you
That's really cool man, glad to hear it helped!
Good luck!
@@GabrielAguiarProd Oh definitely.
I caught on that I had to use static meshes for a lot of particles.
But I hadn't caught on how to create them for fireballs, megaman style blast etc.
And then you made that little one and I was like
🤦♀️
Obviously. Onviously.
I've been trying make these spikey layered arrow like things that are not only a failure at optimizing look like CRAP.
Maybe on complex ones you toss same mesh scaled bit different inside with a different rotation setting but, simple shape, and the texture.
🤦
So embarrassing
woa the whole work flow, im gonna have to watch this atleast 10 times before i start understanding all the stuff being changd in the particle settings,
you're real life hero dude, thanks you a lot
Really really helpful, a tutrorial for blender, photoshop, unity and c#
love it
i'm so lucky today i just checked your video about fireball spell and Luckily you upload that video today which is really awesome keep it up man
2:10 scale it to zero and than use merge by distance is pretty interesting move. I prefer select each square separately and by pressing alt+m I merge them in the middle. But it is the same number of steps.
i recently buy your vfx course on udemy, it is awesome, thank you for your awesome support to share knowledge
Thank you for this tutorial, worked for me like a peach
You’re welcome 😊
Thanks for the tutorial man. Really sweet from you
Amazing tutorial, subbed!
amazing work, thank you.
Great tutorial! Awesome work! I was wondering if you knew how you could render the hit impact effect in front of the wall so its not half clipping behind it?
Another awesome tutorial! I really want to know how you made that fire projectile at around 32:14. Did you also use a mesh for that?
Thankyou so much. This is a really great tutorial. I learned a lot by this. Thankyou
I love your tutorial, I think it is my favorite of the day ahah
Great work. Thanks for sharing your knowledge. 👍🏼
Amazing, I love your work!
Always really thank you i love you~~
Another sub right here! Keep'em coming! :)
this tutorial is Awesome and the structure for the scripts is very good to :D, i'm a subscriber now ;). i cant be a patreon at this time sorry. thanks for sharing your knowles
Just a little tip, make sure you understand that you need to have the prefab as your game object from assets, not from the Hierarchy. Otherwise prepare for headaches!
You just solved my problem man...two freaking days trying to solve it, almost ended up re writing the entire script from scratch
Thank you, this is realy excellent tutorial!
Thanks for this tutorial :) I've watched it several times and it really helps with my project considering i have not much experience with coding und unity in general
Great to hear it! 🙌
[Range(1, 1000)] public float speed = 1;
here is another tipp, if you put a limiter on the public variables input and initilize it. you do not need the if clause to check if it has speed. Meaning that you don't go into the if clause every time in update but only check once, thus reducing allot of processing power and increase performance dramatically (well dramatically in context, I know pcs today have so much power).
Great videos, great assets, many thanks!
Now I know what to do if I was to make some *boss* particle effects for a character's magical weapons, for example the Mirage Blades/Summoned Swords/Sword Illusions.
you are the best
thank you so much dude you helped out alot
A short intro that's doesn't have obnoxious music? What is this witchcraft?
Hey there, amazing video. I pretty much got everything working and then started experimenting. I made the list bigger and put different prefabs with different fire rates into it and I bound them to different buttons. If I fire them separatelly they work perfectly but when I try to use fire two different ones after each other the fire rate gets messed up. Lets say I have one that fires every second and a second one that fires every 4 seconds. I start fireing with the first and it goes out each second but when I fire the second one I have to wait 4 seconds to shoot with the first one agian even though it should fire every second.
I figured it's becasue the script sets the timeToFire variable based on the last projectile fired, so I tried to put it on the move projectile script and tried accessing it the same way we did with the fire rate so that it should fire whenever Time.time is smaller or equal to whatever is set in the move projectile script, but then I got an error because the script couldn't find a reference for it. I will keep trying to figure it out, but I'm somewhat of a newbie to coding so if anyone could give me some help I would be very grateful.
Your video is awesome, but you should zoom in when writing code so,that we can understand better.
Totally agree with you :) Thanks
Great work, thanks for this.
Thanks a lot for explanation
You are welcome
You just fixed my problem, sub for that :)
Awesome man, glad it helped.
Amazing video!
I dont know if you will check the comments but the asset pack in your page is showing "20,00$" instead of "20.00"
Why u sounds like Gru from Despicable me. But however, the tutorial was awesome. Thank you✌✌
Ahaha gonna take that as a compliment I guess
god damm dude thanks so much looks awesome
this is sooo great!
virei fã :)
Obrigado Paulo!
Thank you again!!!!!!!!!!!!!!!!!!!!
Its very hard for people to try to learn something when theres so many steps involved. Its so easy for us to miss 1 step and have a TOTALLY different reaction in Unity.
Hi Gabriel
Could you suggest how to fix the projectile such that it only travels along say... X and Z? I am following along with your video and I trying to make a sort of... top down shooter, but in 3d space and I am trying to just have the projectile shoot straight out of the origin?
I've spent about 2 days on this problem now and cannot seem to get my raycast to project properly...
Thanks in advance!
love this
Very nice.
Amazing tutorial. I was wondering how can I make the effect of the beam getting stuck in the wall?
Hello.. I'm following the coding part and it all goes fine untill OnCollisionEnter method/fuction. The projectiles spawn and get destroyed immediately so no animation plays of projectile actually shooting. Does anyone know why?
You've just said it, it destroys itself so you might need to run a timer or coroutine so it waits for the animation clip to play and destroy once it's finished
Destroy(someGameobject, animator.clip.length;)
This will effectively destroy the object after the animations played
amazing tutorial thx
hi thanks for great tutorial
Very Cool.
Set your rigidbody as kinematic if you're controlling its movement.
good work man
Thanks dude
This is so cool thank you so much!! Is there a way to make the projectile follow a path until it colides ?
I would recommend not to copy paste the same code ( destroying particles ) , but to create a reusable private method , then you could reuse the method.
I know its a tutorial but it would be cool to show others cleaner code
Yes that's true, I should I've at least mention that.
Nice Tutorial as always! May I know what's the bgm you use for 12:06?
thx
Thank you!
Thanks 🙏🏾
I got a problem in Unity2018 with rotation script. My object was rotation not directly to the collision or mouse point, but a bit to the side on X and Y axis. I fixed it by changing "var pos = rayMouse.GetPoint(maximumLenght);" to "Vector3 pos = rayMouse.GetPoint(maximumLenght);". I don't know why it works like this, but maybe it will be heplful for someone.
Gabriel, do you have any ideas why just making a variable strictly Vector3 fixed such issue?
It would be cool if you could release the proyect! maybie without any proyectile on it but with the script and the objects, i think it would be awesome if people could actualy download it and actualy test it and learn how that code actualy work for several uses, not only shoting testing.
Simple yet usefull script, my Congratz for that.
Well, for a small amount, you can get access to the project we created in this video:
www.patreon.com/posts/20996029
And even get access to a few more VFXs.
Thank you and good luck!
@@GabrielAguiarProdno thanks, i notice after than you are selling that kind of access, but i wasn't speaking for me, nor do i was speaking about the full proyect anyway, i'm speaking about the code, that because is already present on the video, and also because could help people more intrested in Graphic Designers, than aren't usualy the best bullets in the gun when dedicating themselfs to code.
That been said, i think is a good iniciative the way you do this, and i wish you the best on your sellings.
Have a great day!
Obrigado mano
Hey Gabe. are the packs 'Unique Projectiles Volume 1/2' avaialble via your patron? Or do we get more content buying directly from the Unity Store? Great packs, great lessons
Hi James, yes they are available via my Patreon too.
Thanks for the vfx games
Wow, thanks!
Would love if I could see font in larger size. Atlease, please provide the code as it is awfully difficult to read sometimes
When i add the "collision" stuff the bullet wont appear :( Help pls
same problem here, using latest Unity 2018.3
You probably already forgot about this problem and solved it. But for others in the future who will struggle with it. I think the reason is probably the value in the "Start Lifetime" section in the projectile options. Just change the value to 1 or more and click "apply" on top(for the beam effect too of course).
It helped in my situation.
Good luck!
Or it could be that your object has a character controller and you have the spawn position in/too close to the collider
This is a great vid is there a way to apply this to a fps?
Hi Gabriel,
here is Shadowless Studios, I buyed your asset and i have a big problem. I used the Circle07:MobAddScoll with the shader GAP/AdditiveMobileDisortionScroll. On PC it works fine and got the movement i want, very nice. But on Mobile Release, it ist just PINK. Why ?
The Projectile isn't destroying for me it just keeps moving through my objects. I have the box collider on and set as not trigger along with the projectile move script is applied to it. I don't know what's going on hopefully you can help me.
waooooo!thank you!
Hi,
Thanks for your perfect tutorials.
Can you please share that two textures (That you use in video) with us?
What should I do if the muzzle prefab and hit prefab of my projectile move do not work? Can someone tell me? Thank you
Is there a way to spawn the projectile without the rotateToMouse script?
I couldn't follow this, too hard. got completely lost after the first script, I don't think I did it well and don't have a way to check if the script is even working. Also I don't know how you added the script to the scene, since when I open the scene, nothing appears on the hierarchy!?!??!
HELP
I really need one tutorial. Can you show me how to emit particles from a texture? That would help me a lot!
I cant get any scripts from this tutorial to work??? Id there any changes in newer Unity versions maybe? :(
I really enjoyed making these effects.
I have a problem, when I use this script in a car mounted turret, it works perfectly fine. I can shoot while driving. The problem is that when I turn the car to the other direction (away from z-axis), the direction of the turret remains the same, it does not rotate according to the car. Can you help me with the *Rotate to mouse* script?
Awesome)
Why my bullet goes up when im shooting the bullet out of the tank
This seems a great tutorial.... but since 2:00 I've been running 0.25x speed and I still couldn't pass 2:55, lol. God of Blender plz help me.
The inputs that he is using on blender are written in the bottom left of the screen, if it can help :)
well Blender was the easiest part here :D
i followed your tutorial but I am having issue with the script saying "the script needs to derive from MonoBehaviour? How can i fix this
I somehow can't find the part where the projectiles get destroyed after a traveling a distance or something, so everything not hitting a wall will survive and clutter up the memory.
sick, i almost gave up
My fireRate isn't working, it shots only one projectile when I press play that's all, anyone knows ?
Hi great toturial
But on 11:05 it gives me a bug Cannot implicitly convert type GameObject to List GameObject
Its give me a sign that the bug is before Instantiate do you know how can i fix it?
And thank you
when you type the effetsbound equals to vfx then what you typed in the bracket
Ok ..so how do you make a Fire point ... Is it just an Empty game object ?Thanks
is there a way to make the ai controller for this projectile script? I'm tryimg to make a racing game like mariokart and i need to get it to where the ai vehicles uses the projectiles
Can someone please share the Blender projectile file? That would be super helpful. I am new to Blender and simply cannot follow what he is doing in Blender (plus, most of what he is showing simply will not work in Blender 2.8 due to the new UI).
What are the settings you have unity using for the lighting and background