Monster shadow


Explosions in Unity! Let's blow some stuff up ;)

Make stuff explode in Unity! Satisfying explosions can add heaps of enjoyment to your players. Learn how to shatter objects, use the AddExplosionForce function and take your game to a whole new level ;) Breakable.cs: Explosive.cs: Cannon:

Recomendation: for better performance use mesh baker(renderer: skinned - for destroyed cube) - at asset store free version is suits well
This has got to be one of the cleanest tutorials ive ever seen. Also, how did you get the game to look so visually pleasing? 😅
@Ashton pan Stay tuned!
Ashton pan
​@Tarodev It is really nice of you to deliver so many high-quality tutorials and reply to our comments. Thank you! 👍 Looking forward to your new video!
@Ashton pan a lot of people have requested this, so I should really get around to it, huh?
Ashton pan
@Tarodev These details make the scene alive. I really want a tutorial explaining how to deploy these little stuff❤️
Ah, well thank you :) Glad you liked it. Visually it's a mix of lighting, pleasing skybox, post processing, some ambient particles (the dust you see floating around), and some shader magic for the boxes. All the little pieces fit together to make something beautiful!
awesome love it🚀😁🥇
Go make some explosions 💣
Hoàng Nguyễn
should a game dev learn everything from Blender to Unity? may be something musical too? Not to mention master C# is not an easy feat. Game dev is such a long and bumpy road...
Long and bumpy for sure, but also very fun. This answer depends on the road... If you're aiming to work on AAA games or in a company, you'll only need programming. If you are wanting to be an Indie dev or collab with 1-2 people, other skills like modeling/drawing/music would come in handy. Just remember, if you focus on all 3 things, you limit your experience in any single skill.
Holy smokes Tarodev! Nothing but good content from this mans.
Glad you enjoyed it 😊
The Excessive
I achieved a similar effect in a VR game I was making this method is cleaner and better than mine thanks. I would really like to know how you achieved the glossy effect on your cubes they look great
Cătălin Berța
I would also be interested in knowing more about the material
can of soda
woah just found your channel from a vid you posted on unity's website and im very glad I have
Future Trunks
@Tarodev Please do a tutorial about your scene(lighting/post processing). how does it looks sooo goood ?
Glad to have you here. Hopefully I can teach you some stuff 😊
Another quality video! Thanks Tarodev
Gary Spencer
Awesome Stuff
Raoul Best
As always, amazing video quality and cool esthetics, love the content
Paulo Rodriguez
damn, i never thought i'd enjoy watching some exploding cubes, this is a pretty cool technique, thank you
srisrid multi purpose channel
You said it


in your favorite 3d editing software create the object you want to explode
i'm making a simple rounded cube i do this by adding a bevel to the
starting cube now save the model to your unity project
bring your object onto the scene and then add a material to it to make it
look pretty add a rigid body increase the mass a little bit and add
interpolation for smooth physics animation
add a collider to your object i'm using a box collider
create a new c-sharp script called breakable
add it to the object and then drag your object into the project pane to make a
new prefab duplicate your object a few times
scatter them around the scene for your explosion point i'm using a
little cannon i modeled in blender but your force can be applied from
anything like a bullet melee weapon or a vehicle i set up my
cannon to fire a ball when i press the spacebar
i'll put the cannon along with the scripts in the description if you'd like
to use it let's try it out
hmm that's not very fun let's make our object shadow
upon impact your cube in blender save a new version of it next to your
original cube but called this one broken an easy way to shatter an object in
blender is by using the self fracture add-on
do this by going edit preferences add-ons
and searching self-fracture select your object click the object menu
quick effects cell fracture ramp up the noise and click ok
delete the original cube leaving just the fractured cells
save the changes back in unity pull out your broken
object and select the child cells add a rigid body and set the mass
to a fraction of the original unbroken object
add a mesh collateral and set convex mode to true
finally add the same material as your original object
make a prefab of your broken object let's open the breakable script we made
earlier and begin coding there's a bit going on here so let's go
over it first we want to make sure that this is not already broken
if it is cancel execution we check to see if the collision was
strong enough to break our object by comparing the magnitude of the relative
velocity with our serialized break force variable
if so set broken to true and then spawn our
replacement object in the exact position and rotation as our current object as
the projectile hit the main object and then we spawn the fractured object
after the fact the cells didn't experience the
projectile's impact force so we have to fake it
by using add explosion force grab the rigid bodies from the replacement
object using get components in children and iterate over them using a 4-h
loop for each rigid body called the add explosion force function
for the explosion force pass in the magnitude of the collision
and multiply it by a collision multiplier i find 100 works well
for the explosion position use the first contact point of this impact
and give it a radius of 2. finally destroy the original object
back in unity ensure you assign your broken box prefab
to your box breakable script let's see how this looks now
okay that's starting to look pretty good but i don't think it's explosive enough
let's fix that by adding some tnt create a new script
called explosive this script is similar to the breakable script
with a few key differences instead of spawning a new object when our trigger
force is reached we'll instead grab all surrounding
objects and add force to them use physics overlap sphere to fetch the
surrounding colliders iterate over them and grab their rigid
body if they don't have one just skip this object add explosion
force to the surrounding object pass in the explosives force set the
origin to the center of this tnt object and set the explosion radius i'm
spawning a particle effect for a bit more possess
finally destroy the tnt object for my tnt i'm just going to use the
same cube i made earlier give it a nice red material attach the
explosive script add a box collider and a rigid body and
then create a prefab of the tnt place the tnt in your scene and let's
see how this looks that's the stuff try adding some new
breakable objects to your scene and playing with some structures
okay this is getting a bit crazy alright one more