Transcripts
1. Trailer: Have you ever wanted
to create mind blowing physics
simulations Blender, whether it's realistic
object collisions, destructions, or intricate
chain reactions. This course will teach
you everything you need to know about
rigid body simulations. Anya seen a three D artist and instructor with over
7,000 students. And in this course, we're diving deep into Blenders
physics engine. No flock just hands on
learning with real problems. You start with the fundamentals what rigid bodies are
and how they work. Then we will break down
settings like mass, collision shapes, and
surface response. So you can optimize your simulations for
realism and efficiency. We'll also explore the
rigid body world settings, giving you full control over gravity, speed,
and interactions. But the real magic
happens when we apply these concepts into
practical projects. We'll make a line
of domino pieces fall in perfect sequince. We'll create this mesmerizing
gltenbard simulation that forms a perfect bell curve. And finally, we will
construct a building only to demolish it in a
spectacular simulation. This course is designed to
take you from a beginner to a confident physics artist with easy to follow lessons
and hands on experience. So if you're ready to bring your three D scenes to life
with physics enroll now, and let's get started.
2. What are Rigid Body Simulations: What are rigid body simulations? There are many types of three D simulations fluid dynamic, volume simulations, soft
body dynamics, and so on. Among these, rigid body
simulations are a key category. Unlike simulations that model
deformation or fluid flow, rigid body simulations
focus on calculating the movement of solid,
non flexible objects. Specifically, they
track the changes in an object's position or rotation without
altering its form. So if you're simulating
interactions between solid objects like colliding blocks or folding debris and want to
preserve their structure, rigid body simulations
are the way to go. Let's jump into blender and learn the basics
of how this works. Okay, so welcome in Blender, and this is a
really basic scene. I have this plane with this
grid texture slapped on it, and also I have this red sphere. Let's say,
hypothetically, I want to simulate how will
this red sphere fall? And this is an instance where
we can use the power of the rigid body system in blender to do these
sort of simulations. And all you need
to do is to make sure you're selecting
your sphere. Next, jump to the physics stab, and from here, you can add a rigid body system
to your object. And now if I hit play, this sphere will start
falling indefinitely. Adding a rigid body system or
a rigid body simulation to an object is just as easy as just clicking this
rigid body button, and by doing that, you will have a basic rigid body
simulation going on. But let's say I want this
ball to bounce on this floor. So we need to figure out a
way to tell Blender that, Hey, Blender, consider
this the ground. The problem is if I add a rigid body to it
and then hit play, you will notice that
they both will fall, and this is where this
type will play a role. From here, you can
change the type from either active or passive. If I select this plane and
change its type to passive, now if I hit play,
you will notice that the ball will basically
fall on this floor. In the next couple of videos, we are going to go over all
the different settings, so don't worry about that. This is just an example
to showcase the logic and the philosophy behind how the rigid body system
works in blender. So this sphere is set to active, which means it can
move and all of that. Meanwhile, the
objects that I don't want them to move or
I just want them, let's say, to be obstacles, I'm going to set
them to passive. I'm going to show
the blue ball also, and I also have this
collection called obstacles, which if I enable it, you will have these wood pieces that will act as obstacles. If I hit play now, only
the red ball will move let's say I also want
to move this blue ball. I'm going to add a
rigid body to it, and also I will set it to active because I wanted to move. I wanted to be part
of the simulation. If I had play, both of
those two balls will fall. But I want also
these wood pieces to be part of the simulation. That's why I'm going to
select, for example, the first one, add
a rigid body to it, and I don't want it to move. I want them to be static. That's why I'm going to change the type from active to passive, same thing for the second one, add a rigid body to it
and change it to passive, and same thing for
the third one, add a rigid body and
change it to passive. And now if I hit play,
notice what will happen. As you can see, both
the two balls will start colliding with
these wood pieces, but also at the same time, they will collide
with each other and they will push each
other as you can see. And this is the most
vanilla version of how you can create rigid body
simulations in blender.
3. Rigid Body Settings: Rigid body settings. Hey, everyone. Welcome back. In this video we'll explore the setting step
of rigid bodies. We'll cover the
basics like mass, and we'll also explore what these two settings do
dynamic and animated. So yeah, let's dive in. Welcome to another basic
scene inside of blender. Let's say I want to make
this red ball fall. As we talked about that
before, first of all, jump to the physics stab, add rigid body system to it. And let's start, first of all, talking about the type which
is either active or passive. When we talk about
an active object, that basically means
that the object will be directly controlled by
the simulation results. In the object will be part
of the simulation and it will be dynamic and it
will be moving around. We want this red sphere to
fall and move and all of that. That's why I'm going to
set its type to active. Now if I hit play, you will notice that
the ball will fall. The only problem is that the ball will go through
the floor because blender right now doesn't consider this floor
part of the simulation. Select this plane, add to it another rigid body system,
and in this situation, if I keep it the plane will
also fall with the ball, but we need it to stay
aesthetic object. And that's what you can
exactly do by selecting the plane and changing the
type from active to passive. You can think of a
passive object as just aesthetic object that the other objects
will react with. It won't move or any of that. It is just there to
control the simulation or to act as a passive
object, basically. So now if I hit play, you will notice that this ball
will fall on the floor. And this is the
difference between an active object and
a passive object. One of them will move and react with all the
different objects, and one of them is you can
think of it as an obstacle. And that obstacle is used for the other objects to react to. And right now, we created
a really basic scene or really basic simulation where
this red ball is falling. Jump to the other
settings right now. I'm going to select the ball and let's talk about the other
settings that are right here. First of all, you have the mass. I think that should
be self explanatory, which is the mass of the object. And one of the nice
things about blender is that while you're selecting
a certain object, if you jump to the
window object, then jump to rigid body, you will have here an
option for calculate mass. If I click on it,
Blender will give you different presets or
different materials that a blender will
use to calculate or to estimate the mass
of such an object. Let's say, for example, if this bowl was made of
iron, as you can see, Blender will tell you
that probably the mess of this ball will be 876 kilos. So that's a handy option
that can help you if you want to create more
accurate simulations. I'm going to put
this back to one. And now let's move on
to this dynamic option and the animated option. When it comes to moving
objects in blender, there are two main
systems for that. One of them is called
the dynamic system, which means that the
object will move and all of that based
on the simulations, based on the dynamic, based on the physics system, and the other
option is animated, which is another way
to move the object or transform it by using
keyframes using the timeline. The animated option is more powerful than the
dynamic option. And what I mean by powerful is that if I check the
option for animated, that will cancel
the dynamic system. Now, because I checked animated, if I go to frame number
one and hit play Nothing will happen because when you
check the animated boxes, that's a way to tell
Blender that, Hey, Blender, I'm going to move this object based on the animation system, which means I'm going to create keyframes
and all of that. Meanwhile, if I disable
the animated option, now this object will be
controlled by the physics system. Now you might wonder, how is
this supposed to be help? Actually, a lot of time
you will find yourself wanting to do some sort
of keyframe animations, and later on, the
keyframe animations will turn into a physical
simulation. Here's an example. I'm going to go back
to frame number one. I'm going to select this ball, hit Alt g to clear the position, which will move this point
to the center of the scene. I'm going to hit three also from the number pad to jump
to the side view, and let's move it somewhere
right here, let's say. So now I have the
following scene, and actually I want this
ball to be around here. So I'm going to hit seven
and let's move it here. Let's say,
hypothetically, I want to push this ball so it
pushes this wood board. In such a scenario,
you will find yourself wanting to use the animated
option because you want to control the position of this red ball using key frames and later on switch it to a dynamic option so it can
be part of the simulation. First of all, I'm going to
select this wood board, and I'm going to add a
rigid body system to it. I want to keep it
as active because I want it to fall and
move and all of that, so it should active
and I'm going to leave the mass the
way it is 1 kilogram. I'm going to jump
back to this ball, and I want to move this red ball so it pushes this wood board. So while you're
selecting this sphere, make sure to check
the animated option. Let's jump to frame number one. Hit K to add a keyframe, and let's add a keyframe
for the location. I'm going to move forward 30 frames to the
frame number 30, JX to move it on the X axis,
and let's push it here. Hit K again, and let's insert another keyframe
for the location. And now if I jump to frame number one and hit play,
notice what will happen. Basically, we were able
to animate this ball and the other objects will react
to that in a physical way. Something else you can do
because this ball right now is only controlled
by the animated system. For example, you can
jump to the frame number 29 and create a keyframe
for the animated option. So up until the frame 29, this ball is controlled
by the animation system. At frame number 30, I'm going to turn this off
and create another key frame. So at frame number 30, this sphere is not controlled by the animation system anymore. Now it will start to react
in a physical way using the dynamic system or the physics system
inside of blender. If I jump back to the
frame number one, hit play, notice
what will happen. So as you can see, the
ball right now will continue moving because
after frame 29, it is controlled by
the physics system. So in summary, if you
check the animated option, the object will only move
based on the animation system. Blender will not consider
the dynamic system in that situation
because it is like you told Blender
that, Hey, blender, I'm going to handle this object by myself using the
animation system, and that object will only move based on the key
frames you will set. And if you disable
the animated option and keep the option, that means that you told
Blender that, Hey, blender, handle everything yourself using the dynamic and the
physics rules you have. And if you enable
the dynamic option, basically nothing
will happen and that object will stay static. In this situation, I'm
going to keep it on. And yeah, that's
basically it for the option for
dynamic and animated. And by the way, if I
select this plane, you will notice that when you have an object
that is set to pass will only have one
option which is animated, which means that only in case you want to
move this floor, you can check this
animated option, but it can't be a dynamic option because it is set to passive. And as I said before, when you set an
object to passive, that means that that
object will not move. It is a static object. That's why Blender
doesn't give you the option for the
dynamic checkbox. I hope the difference
right now should be clear between dynamic
and animated, and I will see you
in the next video.
4. Rigid Body Collision Shape and Source: Rigid body collision
shape and source. Hey, everyone. Welcome back. The collisions and Dynamics
tab is arguably one of the most important parts of creating any rigid
body simulation. It plays a huge role in
shaping the final look of your simulation
and determines how Blender handled the
physics in your scene. In this video, we'll dive
deep into all the settings. Break down what they do and highlight some key
points to keep in mind. Let's get into it. Okay, so hello and welcome back
inside of blender. This time we have a slightly
more complex scene. We have this scar. We have this woodbard and
we have this floor. Let's say, hypothetically,
I want to make this scar to fall
on this woodbard. Of course, later it will
slide and fall on this plane. So first thing, we need to
add a rigid body to this one. So make sure to select your car, jump to the physics step, and then jump to rigid body. I think the mass of the
car should be around 1,500 kilograms or 1.5 tons, and I'm going to leave the collision shapes
the way they are. In the previous video, we
talked about the mass. We talked about the dynamic
and animated option. And in this video,
we will talk about the collision settings and
all the other ones here. So I'm going to leave these
settings the way they are, and I will explain
them in a bit. Next, I'm going to jump
to this wood board, and it should be a
passive rigid body. So go rigid body and then change it from
active to passive. And same thing for this
plane, rigid body, change it from
active to passive, and that's basically it. Now, if I jump to
frame number one and hit play, notice
what will happen. Car is sliding, but
it will stop there, which is not realistic. So right now, let's start talking about the
collision shapes. I'm going to select this scar, and you will see this
option called shape. If I open shape, you will
have different settings, and by default, Blender will have this set to convex hull. The shape option is a
way to tell blender to calculate the simulation
based on another shape. Here's what I mean.
First of all, you will notice that
all of these are divided into
different categories. The first one called
primitive base shapes, which is box, sphere, capsule, and cylinder and cone, and the other ones are
mesh based shapes, convex hole, mesh,
and compound parent. First ones or the
primitive based shapes, they always stay the same. Meanwhile, the last three
options depends on the shape. For example, let's say I
check sphere in this time. You will notice that I will have the sphere surrounding the scar. That means that
blender right now will treat the scar as a sphere
when running the simulation. So if I go back to frame
number one and I hit play, notice how the scar will act. It will fall, and then it will
slide just like a sphere. Now if I set this from sphere, for example, to box,
notice what will happen. Now it basically
fall like a box. Let's change, for example, to capsule and hit play, and you will notice how this
car is right now sliding. This is actually
kind of realistic. Let's change to cone or
first of all, cylinder, and you will notice that this car right now when it will fall, it will basically
look like a cylinder, not like this complex
object that is the car. Hit play. It didn't do
what I had in mind. I thought maybe it will
slide or any of that, but it didn't do any of that. And the last option is cone. If I go to frame
number one and hit play, this is what you will get. And because of the
shape of the cone, you will notice that the car is clipping the wood
board right here. So this is it for the
primitive base shapes. These shapes will stay the
same regardless of the object. The last three option,
convex hole, mesh, and compound parent
will vary and change depending on the nature and the mesh of the object. Let's first of all, start
with the convex hole. Sadly blender will not
show you the shape here in the view port of the different categories that are mesh based. But if you hover, for example, over convex hole, you will
have this short definition, which is that a
convex hole is a mesh like surface encompassing
all vertices. One way to visualize how this will look like if
I select the scar, hit tab to jump
to the edit mode, and hit A to select
the entire mesh, and then if I go to mesh, you will have here an
option called convex hole. If I click on it, look how
this car is now transformed. A convex hole is
basically a way to wrap an object in
a bigger object. This will also make
the process of calculating the simulation
easier for blender because it doesn't
need to count for all the different vertices that are forming your complex object. So for our car, this is how this convex hole
will look like. So I'm going to hit
Control Z to go back to my previous state
hit tab again, let me jump back to
frame number one. And if I hit play right now,
Notice what will happen. This is how the car will fall, which is not that realistic. It is definitely better
than some options we saw in the
primitive base shapes, but still it doesn't
look that good. Convex hole is a
double edged sword. For certain objects,
it works really well, and for other objects,
it is terrible. So experiment with it. And generally, the best
option you can always pick, which is also the most
taxing on your system, is mesh because
blender will calculate everything based on the
mesh of your object. I'm going to select mesh, and if I jump to frame
number one and hit play, notice right now how
the scar will fall. Fall like that, and this
is really realistic. By far, this is the
best result we've got. You can see how the car will fall in a really realistic way. The only problem, as I said, this is really taxing, and
it is really prone to error. Blender is not that
good when it comes to calculating simulations
for complex objects. If I go back, for example, around here, notice how
the car is wiggling. I don't know if that will
happen in real life, but it definitely
looks slightly weird, and I think that
part of it is how Blender is not doing a
good job calculating or estimating how the simulation
will look maybe also it is because of the
nature of my object because it is not that smooth. But regardless, when
it comes to mesh, always think about it
as blender calculating the final result based on the
actual mesh of the object. It will give you the most realistic result
most of the time, but keep in mind that it
can be a little glitchy. The last option is
compound parent, which blender will tell you
that it combines all of its direct rigid body children into one rigid body object. This is just a fancy
way to say that if you have some children
to this object, blender will add them to
the shape of the object. Just as an example,
let's say I go Shift A and let's
add a UVsphere, I'm going to hit J and
move it above the car. Let's say something like so. Let's say we put
it right here and I'm going to make it a
children of this car. First of all, I'm going to move this sphere into the
collection of the car. I'm going to select the sphere, shift and select the car, control P, and set
parent to object. Right now, whenever
I move this car, this sphere will be tied to it. We say that this
sphere right now is a child of this car object, which is just a fancy
way to say that they are two separate objects,
but they are connected. But the most important thing, this sphere is still
its own object. If I open the car object, you will notice that you
have this sphere right here, and later on, you
can unpair in them and have them as
separate objects again. Is a really useful
feature that you can always find yourself using. I'm going back to my car,
and in the settings, if I leave this to mesh, look how the
simulation will play. The simulation will play like if this sphere is not
doing anything. Look how it even collides
and clip with the floor. But let's say I want it to
be part of the simulation. That's why you can
change the shape from mesh to compound parent. And the first thing that you
will notice that a blender will tell you there are
no child rigid bodies, which means that I
also need to add a rigid body system to
the children object. Situation, I'm going
to select the sphere, add a rigid body to it, and I'm going to keep
it the way it is. And if I jump back to the car, that notification right
here will disappear. And now if I hit play,
notice what will happen. Okay, Blender is not doing a good job at calculating
what should happen, but I think you get the point. When you set this option
to compound parent, Blender will also consider the children object
in the simulation, and this can be a really
useful option when you have two objects that you want to combine
with each other, but you want to have them
as separate objects. The car and the
sphere. You don't want to merge them into
one single mesh. You want to keep them
as separate objects. So this option for the compound parent
can be really useful. But as I said, blender is not
that good when it comes to calculating the collision shapes for all of these
complex objects. So for our example, I'm
going to select the sphere, and I'm going to delete
because I don't need it. So this is it for the
collision shapes, I'm going to set this
bad boy back to mesh, and you might wonder Okay, how is this supposed
to be useful? The shape option is just a way to make the process
of calculating the simulation
slightly easier for blender by using some basic
shapes or in general, a simplified version of
the mesh of the object. Let's right now move on to the next option,
which is source, which is either
base, deform Final. Let's start with base, and to fully understand
what's happening, I'm going, for example, to add a modifier, and let's say subdivision
surface modifier. The car will look
all weird right now, but it is not a problem. And I'm going to add
another modifier, let's say, for example,
the bend modifier. It it is called deform
simple deform up, this one, and I'm going to
change the type to bend. And let's, for example, increase the angle to something like 180. So we will have this
really weird shaped car. I'm going to jump to
the physics stab, and when we set this to mesh, does Blender consider
the modifiers when calculating
the mesh or not? This is where the source
comes into place. So when I set this to base, Blender will calculate
the mesh based on the original geometry and will not consider the modifiers. If I hit play, notice how
this object will fall. I will fall like usual, which is not looking good. For the second option, which is called deform, blender will only
consider the modifiers that are doing some
deforming to the object. If I jump back to
the modifier tab, we have a subdivision surface, and we have a simple deform. The subdivision surface is
not a deforming modifier. It is a modifier used to add
more geometry to the object. So blender, when I set
this option to deform, will not consider the
subdivision surface when running the simulation. But since the simple deform
is deforming the object, Blender will look at
this and we put it, and we'll calculate it and make it a part of
the simulation. So now if I jump back to the physics step and
it is set to deform, and if I hit play, notice how the sphere or the
scar will fall. As you can see,
blender right now is considering the deform
modifier into the simulation. Now, it might look
similar to what we had when we
said this to base, but I promise you, this is what this deform
option is doing. And lastly, the final option, which is called a
final Blender will consider all the modifiers when calculating the simulation, and if I hit play, let's
hope blender will not crash, you will have something
looking like this, which is way more realistic. If I just disable this modifier
subdivision for a second, this is the previous mesh. When I said this to deform, this is the shape
that blender is calculating or the shape
blender is seeing. But when I said this
to final and let me activate the
subdivision modifier, this is the shape blender will calculate when running
the simulation. Are all just some simple
ways of how you can simplify your geometry so
the blender will have an easier time when
calculating the simulation. So this is it for the
collision shapes, and I will see you
in the next video.
5. Rigid Body Surface Response and Sensitivity: Rigid body surface response and sensitivity. Hey, everyone. Welcome back. Aside
from an object's mass, another key property is
the surface response. This refers to how an object
will behave in a simulation. Does it bounce like rubber, or is it rigid like
metal or stone? In this video, we'll
explore the settings that define both the surface
response and sensitivity. Hello, and welcome back to another basic scene
inside of blender. I have multiple objects
in the scene right now. We will be using some
other objects later. But right now, let's focus on this red ball and in
this huge sponge. So let's say, hypothetically, I want to make this ball
fall on this sponge. So first of all,
select the ball, add a rigid body to it. I'm going to leave the type to active because I want
it to move as usual. For the mass, let's
leave it at 1 kilogram, and I'm going to change the
shape from convex hole to sphere to make the process of calculations a little
bit easier for blender. Same thing, I'm going
to select this sponge, add a rigid body to it and it
should be a passive object, and for the shape,
I'm going to make it the simplest shape,
which is a box. Now, if I hit play, the ball
will fall on the sponge. Now, let's think realistically
what should happen. When this ball will fall, it should bounce
off this sponge. So how can we tell blender
to also do that, basically? This is where the
settings related to the surface response and
sensitivity comes in. I'm going to select,
first of all, the sponge because it is the main object that is
causing the bounciness. So I will select it,
and you will have here a tab called
surface response. Or you will have two options. One of them is friction and
the other one is bounciness. If I hover over friction, you will have the
following definition. It is the resistance of
an object to movement, and the other one is bounciness, which the tendency
of an object to bounce after colliding
with one another. Zero means it will stay still, and one means that it will
perfectly be elastic. The best way I can explain it, you can think of friction when an object is moving
on another object. That's where friction
will play a role. And when it comes
to bounciness is basically when two
objects will collide. Our situation, let's say we want this ball to bounce
on this sponge. So if I select the sponge
and bring the value of bounciness up to one and hit play, notice
what will happen. It won't bounce that much. The reason is because
also this ball, let's say it is a plastic ball and the bounciness
is set to zero. So let's say hypothetically
I set it also to one, which means perfectly elastic. Now look at what will happen. I will hit play,
and as you can see, the ball will keep
bouncing forever. If, for example, I
lower this value to something like 0.5
and hit play again, it will bounce less until
it settle on the floor. Also if I lower the value
for the bounciness here, let's say, for example, 0.5, it will bounce even less. So this is for bounciness. Basically, how will two objects bounce of each other
if they collide? The bounciness plays a role when two objects are colliding. Now let's talk a little
bit about friction. I'm going to disable, for
example, the red ball. I'm going to hide it from
the view and the render, so Blender will
not calculate it. I'm going to show the obstacle, which is this wood piece right here and also this
metal box right here. And let's say hypothetically, I want to simulate how will this iron or metal cube will slide on this woodbard and later will fall
on the sponge. I'm going to select
first of all, the cube. This should be an active object. I'm going to add a rigid body
to it, set it to active. And for the mass, I can jump to object and then rigid body, and then you will have here
an option for calculate mass. And right here, you should
have an option for iron. So I'm going to select iron and Blender will estimate that the mass of such an object
will be 105 kilograms. Can be useful, as you
can see sometimes. For the shape, I'm
going to change it from convex hole to a box because
it is literally a box. And same thing for
this wood piece, I'm going to do a rigid body, and this time it should
be a passive object, and I'm going to
change also the shape from convex hole to a box. This is the most basic setup you can use to create
the simulation. I'm going to jump to
frame number one. And let's hit play,
and as you can see, this is how this cube will fall. But this doesn't
look that realistic. The main reason is this
metal cube is really heavy and it should do a lot of
friction with this wood piece. That's where the friction
value will play a role because right now the friction
value on this cube is 0.5, and the friction value
on this one is 0.5. In such a scenario in real life, you will have a lot of
friction happening. That's why you can
select, first of all, the wood piece and increase
the friction up to one, and also you can select the metal box and bring
the friction up to one. Now if I hit play,
notice what will happen. As you can see, it starts
to slide really slow on this wood piece until
it eventually stops, but it might fall, but there is not enough time. You can also, for example, lower the friction value on
the metal box to something like let's say 0.7 and
let's see what will happen, hit play, and
hopefully it will fall and it won't fall
because we also need to lower the friction
on the wood piece, 0.7, go back to
frame number one. Let's hit play, and
it is falling slowly. Let's hope it will fall, and boom, it fall down. So in this situation,
up until this point, all we're having is a
friction because it is just two objects that are
sliding on each other. There is no bounciness. But the moment this metal box will fall from this wood piece, now we're talking
about bounciness when it will collide
with this sponge, which we set the value for
bounciness to 0.5 if I increase it to one and go back to frame number
one and let's hit play. And when it will fall, it should bounce a
little bit more. In this situation, the
effect is not that clear because this metal
box is really heavy. We're talking about
100 kilograms. That's why it is hard
for the sponge to actually throw this
metal box up in the air. If I wanted to, I can
change, for example, the value for bounciness
to a higher value, and that should technically
make the cube jump a little bit more in the air once it collides with the sponge. But keep in mind
that that won't be realistic because
metal is not bouncy, so this value should
be set to zero. The last two options
we're going to talk about are the dynamics, and you will have
here is dampening translation and
dampening rotation. The word dampening
means slowing down. When we say dampening
translation, that means that we will
dampen or slow down the movement or
the translation of a certain object
or the rotation, which is self explanatory. It is a way to tell blender
the rate of slowliness, let's say, of a falling object
or technically any object. Also, it is important to
mention that this doesn't just work when two objects
are colliding or something. No, these settings will
affect the entire movement or the entire way Blender is calculating the simulation
for that object. For example, if I hit play, notice how will this
metal cube fall? Now if I increase this
dampening to up to one, for example, which
is an extreme value, and now if I hit play
notice how it will fall, it will start falling gradually, like really, really slow, which is absolutely
not realistic. It's like everything is
running in slow motion. Rotation will do a
really similar thing. It is just applied for the
rotation of the object. Now you might wonder, how are these values supposed
to be useful? Wouldn't I want Blender to basically
calculate everything? That is technically true, but these options comes really handy
sometimes when you're simulating objects that
almost doesn't have a weight. For example, if
you try to create a simulation of balloons, Blender will probably will not be able to calculate
how everything will behave because the mass of the cube is almost non existent, let's say, in the eyes
of blender, of course, because it is really, really lightweight or, for
example, a paper. So this option can help you
to create that sense that, okay, this balloon is really lightweight, so
it won't fall that fast. When you increase this value, you can see how imagine
if this was a balloon, it will start to fall slowly, just like in real life. And this is how
these values can be useful for the dampening
translation and rotation.
6. Rigid Body World: Rigid Body world. Hey, everyone. Welcome back. In this video, we will dive into the Rigid Body world settings. You can find these
settings in the scene tab. Adjusting them doesn't just
impact a single object. It changes the overall rules for how the simulation
is calculated. So let's jump into
blender to learn more. Hello, and welcome back. And this is one of the scenes we already saw in
a previous video. And as I mentioned,
in this video, we are going to work or explain the settings related
to the rigid body world. I have no rigid body systems applied to all the
different objects, so I'm going to start, first
of all with the sphere. Jump to the physics step,
add a rigid body to it, and for the shape, I'm going to set it to sphere. Same thing for the blue ball, add a rigid body to it, and change the shape to sphere. For the wood pieces, they
will be passive objects, change it to passive,
and for the shape, make it a box, and same thing
for all the different ones. They should be passive objects. And to simplify
the calculations, you can always turn
them into boxes. And lastly, same
thing for the floor, add a rigid body to it, and it should be
a passive object. Now, if I hit play,
notice what will happen. This is our simulation. Next, I'm going to jump to the scene properties
tab, and from here, we can change a couple of settings regarding
the rigid body world. First of all, you have gravity, which as the name states, it will control the
gravity of our scene. By default, it will be on the
Z axis -9.8 meters square, which is the exact same value
of gravity on planet Earth. But you can play with
these different values, and you will get
different results if I jump to frame number one, and let's say I make the
gravity weaker minus two, for example, and I hit play, these two balls will
start to fall way slower. Notice what will
happen if I hit play. You can also jump to frame
number one again and let's say I want the gravity to also
be applied on the X axis, something like two, hit play. And as you can see, the
objects right now will also fly along the X axis. If you're going for realism, then probably you
want to keep all of these different values to default values just
like in a planet Earth. But I think you can
see how these values can also be useful
sometimes if you're trying to create something stylized
or something that is not physically based on
the physics of Earth. Next, you have the step
called simulation, which is just a
fancy way to tell blender what is the
range of simulations. By default, blender will
render the entire frame range. For example, my current
range is 1-250, Blender will cache or
simulate the entire timeline. If you want to only
simulate a certain range, you can specify that from here, and now we jump to the
most important this video, which is the rigid body world. First of all, you
will have collection, and collection is a
collection that contain rigid body objects that are participating
in the simulation. And for the
constraints, right now, I have no collection
for the constraints, but in case I have, or I created a collection that
is meant for constraints, basically, those objects will be contained inside a
collection right here. I can specify it. Next,
you have the speed, which is just a way to control the speed
of the simulation. If I set this to the simulation
will be twice as fast. If I hit play, the
simulation will be faster. If I type 0.5, the simulation will be slowed down
by half or 50%. This can give you a similar
effect to the gravity. I'm going to set it back to one. Next, you will have this check
box called split impulse. I would highly
recommend that you always keep this option off because it always causes blender to crash
in my experience. If you jump to the
blender manual, you will find a really
confusing definition. It says that split impulse
enable or disable, reducing extra velocity that can build up when
objects collide, lowers the simulation
stability a little, so use only when necessary, limits the force with which objects are separated
on collision, generally produces nicer result, but makes the
simulation less stable, especially when
stacking many objects. To be absolutely honest, I don't understand exactly
what this option does. I tried to look for some
resources on the Internet, but I didn't honestly find
any good explanation. Next, you will have this option called substeps per frame, and this is a really
important settings. Right now, my frame rate, if I jump to the
output properties, it is 24 frames per second, which means each frame
will last 1/20 4 seconds. The substeps per frame
is a way to tell blender the number of simulation
steps taken per frame, which means how many times
you want a blender to calculate the position of
the different objects. Right now it is set to ten, which means that blender will
calculate the position of the different balls in our
situation ten times per frame. And next you will have
the solver iterations. The solver in blender is the algorithm responsible for
calculating the simulation. So the solver iterations, it is a way to tell
blender how many times to run those algorithms
per substep. So one way to think of
this, Hey, blender, for each frame, try to calculate the position of the
different balls ten times. And for each one of
those substeps or for each attempts of trying to calculate the
position of the ball, do ten iterations, which
means calculate or run the algorithm trying to predict the position ten times. Of course, I need to emphasize that yes, I'm saying position, but this goes for all the
different interactions, rotation, objects
colliding and all of that. Next, we move on
to the cache tab, which is also just as important. You have the simulation start
and the simulation end, and this is a way to tell
blender which areas to cache. And right here,
Blender will tell you some information about
the caching process. So 160 frames in memory, 44 kilobytes, and the
cache is outdated, which means I didn't
update the cache. The first option
you will have is BC which literally will bake all
the different simulations, so you won't lose them in case you close blender or any of. Calculate to frame,
we'll calculate the simulation up to
where the cursor is. For example, to
frame 160 right now. Current cache to bake. Current cache to bake,
imagine if I hit right now play and the
simulation is playing. If I click on this option, Blatter will transform
all the things that I cached right here
into an actual bake. Bake all dynamics.
As the name states, it will bake all the
different physics in your simulation all at once. Delete all bakes. That will delete all the bakes
you did before. And the last one, you will
have update all to frame, which will update the
bake you already have. Most of the time you will
find yourself using either the option B bake all dynamics when you
finally finished your scene. And the last tab, which
is field weights, the best way of how
I can explain it is that same as other
physics dynamic systems, rigid body simulations
in blender are also influenced by external
forces effectors. For example, you can
specify from here how much you want to gravity
to affect the simulation. This all option basically will change the overall or all the different
settings all at once. You have vortex, magnetic, harmonic, charge, and all
of those different things. Basically, these are the
stuff if I go Shift A from here and I jump to force fields, you will have all of
these different one are ways that you can also
control your simulation. For example, if I add wind, that might affect the
position of these two balls. So from here, let's
look for wind. I can change how strong
the effect of the wind is. This is also an advanced option since most of the time,
in case, for example, you added some wind,
you can probably change the settings of that wind instead of playing with
the strength from here. So most of the time, this
step isn't that useful, but it can come handy
in certain situations. This is basically it
for all the settings related to the rigid
body world in blender. Next, we are going to start doing some
practical exercises.
7. Galton Board: Gltenbard simulation. Hey, everyone. Welcome back. This is the first exercise, and we will be working
with a Galten board. A Galtenbard is a device where beads are
dropped from the top, interact with the
pegs as they fall, and distribute themselves
to form a bell curve. It's a fun way to put all the concepts we talked
about into practice. So, yeah? Dive in. Hello and welcome back
inside of Blender. This is a fresh blender scene, and we will be doing
everything here. We will append a collection
from another blender file, and we will create
the simulation here. I'm going to pick a
general for the template. I'm going to hit A, X, and delete everything because I don't need neither camera. Nor the default cube. I'm going to change a little
bit the setup of blender. I'm going to hit T
to hide the sidebar. I'm going to also
hide these tools by going to header and
show tool settings. I'm going to expand
this a little bit. And because I think
it is useful, I'm going to enable
the screencast keys, which will allow you to see the shortcuts I type right here. And this is the
basic Blender setup I'm going to use for this video. Now we need to create this
Galtenbard simulation. I'm going to go to File append. And in the resources that
comes with this course, you will have this option
called A Galton board. If I double click on it
and go to collection, you will have this
collection called Append M. This collection contains all the different
other collections. So just click Append
me and you will have three different collection
inside this one. There is one called frame. I'm going to move it
out. Beads and pegs. Now you can delete
this collection and the ependymy collection. So our entire scene is formed by three different
collections that I want to explain each one is
responsible for. I'm going to jump to
the rendered view, and by default, you won't
be able to see anything. That's why I can uncheck Scene world and pick one of the HDRIs that
comes with blender, and this should give you a better view on what's happening. First of all, you
have the front glass, this one right here. I'm going to hide
this bad boy right now because it is
obscuring the view, but it is important that we
have it so that the beads later don't fall in front
of the entire structure. I'm going to hide it. Next,
you have the metal body, which is the one responsible
for basically being the collision object for all
the different beads that will go through here and then fall down and the wood back, which is kind of
self explanatory, it is the back of
the Galton machine. Next, you have the beads, which is this small
sphere right here, we'll be adding a lot of them. I probably at the end, we will have around 600
ish of these beads, and I will show you
how to create them. And finally, the pegs. And the pegs are these
bad boys right here, which are responsible for
colliding with the beads, so they will guide them at
the end to fall right here, and they will form
this bell curve. So this is a small breakdown of all the different objects
in this scene right now, and let's get into the fun part which is
creating the simulation. The first thing I'm going
to start with is by adding a lot of different beads. This will be really simple. All you need to do is
to select the bead, and let's add a modifier to
it called the array modifier. Which will allow
you to duplicate an object a certain
number of times. I'm going to duplicate it
on the X axis for now, so this should stay one, or actually let's make it 1.5. So I will have a
small gap between the different beads and increase the number to your
heart's content. For example, 28 seems
to be a good number. Add another modifier array, and right now we want to array
them on the Z axis down. So make sure to change
this back to zero, and we want them
to go like this, which is the negative Z axis. So do -1.5 and increase this
number to I don't know. Let's say 24 seems
to be a good number. And next, we need to apply all of these
different modifiers, because this geometry
right now doesn't exist. It is generated using the array, and if you want to add a
rigid body system to it, each one of these Bs should
be its own separate object. So the first thing that
you need to do is to apply each modifier, apply apply. Now if I hit tab, each one of these beads it's its own mesh, but we want them to be
their own separate object. So how can we do such thing? This is actually really simple. Make sure to hit tab, hit
A to select everything, hit P for separate, and you will have
here an option, separate by loose parts, which is just a fancy way to tell blender that, hey, blender, each mesh or each part
of my object that is not connected to any other
geometry, separate it. And since each one
of these beads is not connected
to any other bead, when I click this option, Blender will separate
each bead on its own. Click on it and
wait for a second. And boom. Right now, each bead its own
separate object. If I hit tab again, and these are the different
beads separated. If I collapse this collection, you will see that
we have 672 beads, and still, there is a small
problem in these beads, which is the center of all
of them is still here. They all share the
same exact center, which is the origin point of the first bead
that we created. In blender, an important concept that you need
to keep in mind is that it is highly recommended that the origin of the objects
that you're trying to simulate should ideally be in the center or the
origin of each object. That's why I'm going
to double click on this collection to select
it all right mouse button. You will have an
option for set origin and choose origin to geometry. Right now, the origin of each bead will be in the
center of that bead. Now we can move on to adding the rigid body systems to
all the different objects. I'm going to start
with the wood back, so select it, jump
to the physics step, add a rigid body to it. It should be a passive object, and for the shape, change
it from convex hole to box. You will notice also
a small problem, which is that for
whatever reason, the box of the rigid
body is somewhere here, and this goes back to the
point I was talking about, which is that the origin
should be in the center. That's why I make sure to
select this back wood or wood back right mouse button
set origin to geometry, and everything will work fine. Next, we move on to
this metal body, add a rigid body to it, change the type from
active to passive. We don't want it to move.
And for the shape Pick mesh. Convex hole will be terrible. It won't give us the
result we're looking for. There is also another problem
in this object, which is, if I hit N and jump to
the item properties, you will notice that
the scale is not one. The scale is not applied, and that's also an important
thing to keep in mind. It is highly recommended
that whenever you're trying to create
simulations in blender, to have a consistent scale. That's why it is a good
practice to apply the scale for all the different elements that will be part
of the simulation. Select this metal body, Control A, and apply the scale. I'm going to hit to
hide the side bar, and let's move on
to the front glass, which is not visible right now, but also it is important to add a rigid body to it,
add a rigid body. It should also be passive
and for the shape, change it to box,
and same problem. The origin point
is in the bottom. We need to turn it into the center so that the box of the rigid
body will look right, select it, right mouse buttons
at origin to geometry. And hide it. This is how you can add a rigid body
system to the frame. I think it was simple. Now
let's move on to the beads. I'm going to select
my first bead. Let's add a rigid body
to it, a rigid body. I'm going to keep
everything the way it is, and I will just change the shape from convex hole to sphere. And right now, you need to do this exact same thing for
each bead on its own. That's why simulations are time consuming in case
you're wondering. Hope it should be clear
by now that I was joking. But in general, you can always select all the different
objects you have and make sure that you select the object that does have
the rigid body system. Lastly, so it will be the
active selected object. Next, go to object
and then rigid body, and you will have an option
for copy from active, which is just a fancy way
to tell blender that, hey, for all the
different objects, copy the rigid body system
from the active object, and the active object is the last object
that you selected, which is the yellow one which is the one that does have the
rigid body system added to it. A fun way actually to remember this shortcut is
to go to object, B, and then next hit
F, copy from active, which I always like to
remember it as boyfriend, B F. So if I go while selecting the object that does have the rigid body system added
to it as an active object, go to object B. And then F, each one of these
beads right now will have its own rigid body system
added to it. It is that easy. And the last part that we
need to add a rigid body also to it are the
pegs right here, this should also be simple. I'm going to select, for
example, the first peg. Let's add a rigid body to it, and it should be
a passive object, and let's change the
type to a cylinder. And it is looking a
little bit weird because Bolano doesn't understand the
rotation of this cylinder. A way to fix this, actually. I'm going to hit Tab to jump
to the edit mode, hit A, to select the entire
mesh, R X 90. This object right
now is rotated on the x axis 90 times,
and by the way, this will happen to all the
different beads because they all share the same
exact base mesh. Next, hit Tab again to
leave the edit mode, hit R X and 90 again to cancel all the
different transformations, but that will only be
applied to this one. So hit Control Z to cancel
that and make sure to select the entire collection called not beats, called PEGs. Change this from medium
point to individual origin. R X 90, and this will rotate all the
different pegs all at once. So right now, they all have
the same exact rotation. And the really nice thing
is that the shape of the rigid body system will be a cylinder that does follow
the actual cylinder, which is nice because that
will save a lot of memory. The next thing, we need to apply this rigid body system to
all the different pegs, select the entire collection
and make sure that the one with the
rigid body system added to it is the active one. It is the last selected one. Go to object B, F, and each one of these right now, have its own separate rigid
body system added to it, which is exactly what we want. And now, if I hit play, I will have my simulation. So I'm going to hit one from the number pad to jump
to the front view, and let's hit play to
run the simulation. And let's hope everything
will work fine. Hit play. And the
simulation will go haywire. So what is the problem
of all of this? When I first created the scene, I spent a lot of time trying
to figure out what's wrong, and I know what's wrong. The thing is, if I, for example, pick one of these
different objects, let's say, the biggest object, which is the metal head or the
metal, not the metal head, the metal body, and I hit N, these are the dimensions
of this object. It is 1.38 meters tall. Is actually for a Galten
machine that's already big. But for blender, all these different objects
are really small. You have this big object and these beads
are really small, and blender is not
good at all when it comes to calculating
stuff for tiny objects. The solution is
actually really simple. I'm going to hit A to
select everything, and there is a problem, which is that make sure also
to show the front glass because it won't be selected if you do A while it is hidden. Hit A to select everything. Hit S for scale, and I'm going to type ten, which is just a fancy way to say, Okay, something is wrong. I didn't select all the objects. Hit A. Same thing for this one. Okay, everything is selected. We're good. Jump to
frame number one. Hit S and type ten to scale
everything by ten. But why? Hmm. Okay, this is not
looking good, but why? Ah, Okay, because I didn't
change the individual origin, I need to change to
median point, my bad. Change this to medium
point, and right now, if you hit S, you will scale
everything proportionally. So hit S and type ten, which means that we will scale the entire scene by
a factor of ten. Next, hit Control A
and apply the scale, and you will have this
really long message of problems that blender
will show it to you. So we need to solve that, okay? Hit to hide the sidebar, and I'm going to collapse all of these different
collections because I was trying to
know what's wrong. Let's collapse it, and we
will do it object by object. But don't worry. This
will be really fast. So first of all, let's
select this bad boy, Control A, and apply the scale. Same thing for the metal body, Control A, and apply the scale. Same thing for the glass,
Control A, and apply the scale. We're good. I'm going to also hide the front glass
because I don't need it. For the beads, select the entire collection by
double clicking on it, Control A, and apply the scale. Good. And for the pegs, double click on it, Control
A and apply the scale, and you will have this
very long message. The main reason causing
this problem is that all of these different objects
share the same mesh data. So select, for example, one of them, hit Control
A and apply the scale. Blender will tell you that, hey, this will turn it into
its own separate mesh. So I'm going to hit Cancel, and let's select them
all shift like this. And then this one as
an active object, Control A and apply the scale
and this is how it works. Select them, make
one of them the active selected object
and apply the scale. It is that easy. Let's collapse this entire collection because
I don't need to see it. So technically, right now, all the different objects will have a consistent scale of one. Let me hit one from
the number pad, hit eight to select
everything and make sure to show also the
front glass, A, J, Z, and move it on the Z
axis a little bit up, so it will be above the floor, hit end to hide the sidebar and also hide the front glass, hit one from the number pad
to jump to the front view. And right now, we scale
everything by a factor of ten. Hopefully everything in the eyes of Blender right now it is big. So when I will do
the simulation, everything should work fine. Let's try that again,
hit play, and boom. Everything will work fine. I just got to wait for
the simulation to end. And there might be
a small problem, which is that I don't have
a good range for the scene. I might not have enough time
for the simulation to end. And yeah, just as I thought. So let's turn this to
400 and simulate again. Okay, the simulation seems
to stop at this point. And my guess is that if I
jump to the scene properties, rigid body world from the cache, right here, you will
have simulation start and simulation end. Make sure to also make it 400. Let's move back to frame
237 and play again. And right now the
simulation should end at frame 323, 323. So yeah, now this
is our simulation, and it is looking really decent as you can see, also, we're getting the bell curve right here, which is nice. In case you want, for example, also to make the
simulation slower, you can decrease the
speed to something like 0.5 and let's
sit play again, and the simulation right
now will run slightly slower so that you can spend more time looking
at it if you want, or you want to render slow motion render for this simulation for
this gltenbard. You can play with
all the different settings as much as you want, but this is the basic idea. In my case, I'm going to leave it back to one because I want it to be more or less
based on real life timing. And once you finish
polishing your simulation, you can always jump back
to frame number one, and you can choose the option to bake all
the different dynamics. This will bake the simulation, which means you won't
lose any progress in case you close blender and
go back to this project. So click on Bake all Dynamics, let's wait for blender
to bake everything. The bake ended, and this is
my Galtenbard simulation, and that's how you can create. I hope this video was fun. I hope you learned a little
bit about how to troubleshoot different problems when it comes to creating rigid
body simulations, and I will see you in the next video and also make
sure to save your file.
8. Falling Dominos: Falling Domino simulation. Hey, everyone. Welcome back. This is the second exercise. We will be creating a cool
domino falling simulation. This exercise will
be a fun challenge. You will run into plenty
of troubleshooting and get to experiment with different
solutions along the way. It's a great way to build
the problem solving skills you will need when working
with rigid body simulations. So yeah, let's dive in. Hello, and welcome back
inside of Blender. Let's pick General and A, X, and delete everything, hit T to hide the sidebar, and let's hide the A toolbar
header show tool settings. I'm going to expand
this a little bit. Go to file, append. And in the student's
project folder, you will have the
falling domino scene, double click on it,
jump to collection, and pot the dominoes and
the floor and append them. This is basically let me just disable the collection for
the floor for a second, and I'm going to select the
collection for the dominoes, hit the period key to jump
and focus on one object. These are all the domino
pieces in the scene. I have 36 domino pieces, which is how many domino pieces in a set of dominoes, I think. You won't see all
of them all at once because they are over
each other because we need to have them like this for scattering them and
putting them on a curve. I'm going to also jump to the rendered view and let's check Scene world and let's use, for example, DRI or let's keep it to the
default one this time. Let's show also the floor, which will come with
its own material, which is a really simple
wood material that I have downloaded
from the Internet. The first thing that we need
to do right now is to create a line of domino pieces that we will make them
fall, basically. I'm going to hit seven from the top view and let's
zoom in a little bit. I'm going to go Shift A, and let's look for a curve, and let's look for busy curve. By default, you will
have this line. You can hit Tab to
jump to the edit mode. Let's select this point
and hit R to rotate it, and as to scale it
a little bit down. So you will have
something looking like, so it's like an S curve. Right now, by default, it is
inside the Domino's scene, but I don't want it to be there. So hit M to move it
to a new collection, and let's create a
new collection and call it Dominos line, for example, and create. Next, I want to distribute or create or array the domino
pieces along this curve. So how can I do? Well, some of you actually might think
of the array modifier, but this is actually
a bad idea because the array modifier doesn't have many options regarding
the rotation. That's why we are going
to use geometry nodes, but I promise you, it
will be really simple. I'm going to open this and let's open the
geometry node editor, hit to hide the sidebar, and create a new
geometry node tree. And let's call it, for
example, Domino's line. And let's also
enable this magnet, so the nodes will
stick to the grid. I want to distribute the domino
pieces along this curve. That's why I will
start by adding a node called curve to points,
and let's put it here. This will distribute
points along the curve. And let's say, for example, I want to have 30
for now, 30 points. Next, I'm going to add another really handy node and a famous node called
instance on points, which is just a fancy node that will allow me to
replace those points I just created using the curve to points by other objects. What do I want to
replace them with? Want to replace them
with the domino pieces. So just drag the Domino's
collection from here and put it here and take the instances and plug it to the instance. And if I zoom in, you will have something
looking like so, but it doesn't look
right, first of all, because it's like we have the same piece for all
the different pieces. We want blender to use random variations
for those pieces. This is actually really simple. Make sure to check separate
children and pick instances, and each one of
these domino pieces right now will be at random. And you can also see that I'm seeing this collection,
so just disable it. So now I have this line of domino pieces which is
exactly what I want. But there are two problems that I'm going to discuss
them right now. If I hit seven to
jump to the top view, as you can see, the pieces are not rotated in the right way. I want them to be rotated
a little bit like this. Okay? So how can I do such a
thing? This is also simple. If I move these nodes
here and look for a node called rotate order
or actually a line order. So go Shift A, look for a
line rotation to vector, so just pick this node. Put it here and
take the rotation. I'll plug it to the rotation
and take the rotation, I'll also plug it
to the rotation and you will have this result, which is exactly what we want. Now looking at this, I think
I can add more instances. Let's try 40. This seems to be decent. I think I can even make it 50, which will make it
look even better. Next, we need to turn
this geometry into actual geometry
because right now it's all just in geometry
nodes and all of that. So at the end of your note
tree before the group output, go Shift A and add a node
called realize instances, which will turn the instances
into actual geometry. Next, while you're
selecting your By curve, go to object, convert
and convert into a mesh. So now if I hit Tab, as
you can see, each piece, it's its own separate mesh, and we need to separate them. So hit A to select everything. Hit B for separate, and you will have an option
for separate by loose parts, which is the same exact
thing we did for the beads, if you remember in
the Galtenbard video, separate by loose parts. Each domino piece
is its own mesh right now or actually
its own object. Next, they are clipping
down in the floor. So if I select one of
those pieces and hit N to open the side bar
to see the dimensions, you will notice
that the dimensions are 0.1 on the Z axis, and this is basically
in the middle. So if I want to move them up, all I need to do is to
move them on the Z axis by a factor of zero point
1/2, which is 0.05. Select the entire dominos line, hit J Z 0.05, and they should be on
the floor right now. I'm going to hit to high the sidebar and let me
collapse this down. And this is the line of domino pieces that
we will make fall. And the last thing
I'm going to do since I selected all of them, the origin of all the
different pieces right now is right here, which
is not what I want. So I want each piece to have its own origin
and the center. So click on the
right mouse button, set origin and
origin to geometry. That's how I will
leave it for now. An important thing I will
need to mention from now, maybe later maybe since
I want the pieces to fall based on their base, I might need to move
the anchor point or the origin point down. But for now, let's see
how it will look like, and later on maybe
we'll change it. I'm going to hit Control Z to remove this Ti that I just drew. A since I want to make
the domino pieces fall by a sphere, I'm
going, for example, to jump to the first
domino pieces, Shift S and cursor to
selected, Shift A, and let's add a mesh called UVsphere I will have this
giant sphere right here, so hit S to scale
it way way down, zoom in a little
bit, scale it even more to something like this. And you can hit three to jump
to the side view or one, and let's move it around here on the floor and Shift C to resist the position
of the three decursor. Hit seven to jump
to the top view. Let's move it here, and I wanted to push the
first domino piece. So let's start creating right now our rigid body system. Okay? First of all, I'm going
to start with the floor, which I'm going to move
outside this collection called collection and same thing for the dominoes and delete
this collection. Like the floor, go
to the physics stab, add a rigid body to it, and change it to a passive. Next, we move on to
the domino pieces. Let me select the first piece, add a rigid body to it, and let's make it
an active object. And for the mass, I'm
going to lower it to 0.1. And for the shape,
let's make them box. And it looks all weird, but we will fix
that in a second. Next, I'm going to select the entire collection
and make sure that the active selected object is the one with a rigid
body system added to it. Next, go to object B, F, and each one of these
pieces right now will have their own separate rigid
body system added to them. But there is a problem
with the rotation. I was thinking that
maybe I can solve this problem doing the same
thing I did for the pegs, but I don't think so since each one of them does have a
different box around it. So I think this is one of those situations
where I will need to change the rigid body system to actually work based
on the actual mesh, and I need to go to object, rigid body, and
copy from active. So each one of them will
be based on the mesh, which probably will cause
the simulation to be slightly heavier
and more unstable. But I think we'll be
fine in this situation because still the shape is
more or less pretty simple. For this sphere, I'm going to hit N and I need to
apply the scale. Control A, apply the scale. Let's add a rigid body
system to it, okay, it seems like it already does
have a rigid body system to it because when I select
the entire collection, apparently the sphere is
also inside this collection. So just for clarity reasons, I'm going to hit
M, new collection, and I'm going to call sphere, and let's collapse
this dominos line. And for this sphere,
let's see what does the object or the
physics part does have. I'm just going to change the
shape from mesh to sphere. And for the type, let's
keep it at active. And since I want to move it to push the first domino piece, I'm going to check the
option for animated because it will be animated using
the animation system, not the dynamic
system in blender. I'm going to jump to the
timeline where is the timeline. For the first keyframe
or for the first frame, I'm going to hit K and let's insert a keyframe
for the location. Next, move it forward. Let's say to frame number
say to frame number ten. Okay, for whatever reason,
everything exploded. So let's jump to
frame number 20. What about frame number one? Okay, since the
simulation is playing, I'm going to disable the
sphere for a second, and let's see if I hit
play, what will happen. Okay, everything will
explode for whatever reason. Part of me thinks that it's
because of the origin point. So let's select all
the domino pieces, it tap to jump to the front view or actually hit tab to
jump to the edit mode, hit A to select everything, J, Z, and move them on
the X axis by 0.1. This is not looking good. What I'm trying to do
is to move the center of each domino piece
in the bottom. But each one of them does have a really weird way of how
the center is located. So let's just move here, set origin to center of mass on the surface,
three to jump. Still, some pieces does
have weird placement. Like for example,
these ones right here. Like this one, for example. So how can we fix this issue? Three. Let's select all of them, set origin to the volume. And yeah, this
algorithm is doing way better job at moving the center of the
different objects. Hit one to jump to the
front view, tab, A, select everything JZ and move them so that the center
will be in the bottom, just so you don't
have to be precise. Just make sure it is around
the bottom of each object. Let's say something like this. Next, I'm going to head
JZ and move them down. To be almost on the floor, and this should technically make the simulation more
stable if I hit play, and they explode again
for whatever reason, so we need to figure out
a way to fix this. Okay. I'm going to hit JZ and move
the plane a little bit down, and I'm going to select
all the domino pieces and make sure this
one is active. Let's change the shape from
mesh to convex hole, okay? Object, rigid body.
Copy from active. So each one of these will
have a convex hole shape, which is simpler for
blender to calculate. Hit Space bar to play
this simulation. And this is way, way
better, I think. Yep, this is exactly
what we want. So move back to
frame number one, select the plane, l J
to reset the position. If I hit play, everything
is super stable, which is exactly what we want. Next, hide the sphere and hit seven to jump
to the top view. Make sure I frame number one, we already added a keyframe. So jump to frame, for
example, number 20, J, and move it to push the
first domino piece, K, and insert a keyframe for
the location and make it a linear by hitting T and choosing linear for the keyframe
interpolation. And now let's hope
everything will work fine. Okay? If I hit play, Okay, it is not looking good. It is maybe because we
changed the origin earlier. So let's select all the
domino pieces and do set origin set
origin to geometry. And what should happen?
Now, let's see hit play. No, this is a bad idea. So let's do Control Z. And for the mass, let's
see the physics step, maybe we can make them
slightly lighter, but I don't want to do
that because that might cause the simulation
to be unstable. What I'm going to do instead
is a small experiment, which is to disable the sphere, and for the first domino pieces, I'm going to hit R x to
rotate it on the X axis. And let's say I want it to
fall on this one, okay? Just like so. On
frame number one, if I hit play, Nope. Somehow it looks like they
bounce or something like that, which I don't know
why it's happening. So I'm going to
reset the rotation, and I'm going to do
something I already did, which is select all the
different domino pieces, set origin to the center
of mass or volume. Let's unhide the sphere
again and hit play. And yeah, now it's
working way, way better. So by setting the center
to the center of mass, we solve the problem
of them wiggling on their base because
this is way better. And when this sphere will
hit them, boom, they fall. And this is actually
looking really sick. So let me just do this. This is really nice.
The last thing you can do is probably jump
to the Physics tab, for example, which
is in the scene tab, and let's make it, for example, 0.5 in terms of speed, so it will run slower so we can spend more time watching it. And this is really sick. Now, of course, you can
spend some time trying to render the scene maybe add a camera that will follow the domino pieces falling
and all of that. You can play with all of that
to your heart's content. The last thing I'm going
to do is to jump to the case tab and choose the
option for BCO dynamics. And yeah, this is it for how to create a falling
domino simulation. As you can see, it is
a really fun exercise, and the result is really nice. And you can probably
create something more creative than
what I just did here. Maybe you can distribute them so they will reveal
a certain shape. There are a lot of things you
can do with domino pieces. This is basically
it for this video, and I will see you
in a future video.
9. Rigid Body Constraints: Rigid body constraints. Hey, everyone. Welcome back. An important concept in
simulations is constraints, and constraints define the relationship between
different objects. These settings are especially useful when dealing
with objects that are made up of different
materials or pieces or when you want to create specific
interactions between objects, this video will be slightly
longer because we'll be exploring each type of
constraints in detail. So without wasting any time, let's learn about constraints. Hello and welcome back to this really basic blender scene where we will learn about
the fixed constraint. We have a really basic scene
where we have this floor, a bunch of wood obstacles, and this hammer on top. The goal of this video
is to learn how to make this hammer fall
in a realistic way. So the first thing I'm
going to do is to add a rigid body system to all
the different obstacles. Just select one of
those wood boards, jump to the physics stab, add a rigid body to it, and change it to passive. And for the shape, I'm going
to turn it into a box. Now we need to copy this
rigid body system to all the other objects instead
of doing it manually. While holding Shift,
select the rest of the objects and
make sure that the active one with the
yellow outline should be the active selected object and the one you
selected the last. Next, go to object BF
and this will copy the rigid body system from the active objects to
the rest of the objects. This is a basic
workflow that we've been doing from the
beginning of the course. Next, we need to
make this hammer fall in a realistic way. And right now there is something important
I need to mention, which is that hammer
is not one object. If I open the collection
called hammer, you have the handle,
the wood handle, and you have the
metal head, okay? So each of them is
a separate object. And that's a realistic way of how to do it
because these are two different things
that are joined together just like in real life. So how can I make this
fall in a realistic way? The basic instinct
or some of you might suggest is to add a
rigid body to this one, and let's say,
since it is metal, let's say 30 kilograms, and for the shape, I'm going
to turn it into a box. And for this wood, handle, I'm going to add a rigid body, keep it as active, for the mass, keep it 1 kilogram,
and for the shape, also change it to a box. And now, if I hit play, hopefully everything
will work fine. So let's set play to
see what will happen. And yeah, it doesn't
work the way we want it. They fall in a really
weird way and they get separated from the beginning
of the simulation. So why is that happening? Well, because blender
doesn't know that both of these two objects
are joined together. So what's the solution?
The easiest solution that also some of you might suggest is to join both of these two objects, the
handle and the head. I'm going to remove
the rigid body from both of them for a second, select both of them, and then do Control G to combine them. And now I can add a
rigid body to it. Let's say the total
mass will be 31. If I hit play now, it
will fall this way, which is not necessarily bad. You can do way worse than this, but still the hammer
maybe will look fine. But with other objects that are slightly more complex,
this will look terrible. The main reason for this
is because, for example, this hammer, the head should be way heavier than the handle. But when we join them together, everything will
have the same mass. Blender will treat
the wood handle. Same way we'll treat
the metal head, and this is not realistic. That's why, especially in exaggerated examples,
for example, imagine this wood handle should bounce or it is
a really soft material, and this metal head is
metal and it is heavy. So you need to simulate for both of these materials
at the same time. But when you combine
them or join them, Blender will treat them
as one object that is created from
the same material, and this is not what we want. This is where constraints
comes into play. I'm going to hit Control Z to cancel the joining
movement that I did and also remove the rigid body system
that I just added, and we're back to
each one of them being its own separate entity. A rigid body constraint
is a way to tail blender the connection
between two objects. I will always go back to this definition because you
need to always remember it. A rigid body constraint, a way to tell Blender
how to join two objects, or what is the relation
joining two objects? And another question you will
always need to remember is to always ask yourself when you're trying to do
rigid body constraints. What is the relation
between these two objects? I'm going to ask you now, what is the relation between
both the wood handle head, and the answer should
be really simple. They should stick
together. They are fixed. They don't move in
relation to each other. And there is an
exact constraint for this one that is called
the fixed constraint. Before I explain how to do that, I'm going to select
the wood handle and add a rigid body to it. For the mass, keep
it the way it is, and for the shape, I'm going
to turn it into a box, select the metal
head, rigid body, active for the mass. Let's make it 30 kilograms, and for the shape, I'm going
to turn it into a box. And now comes the
rigid body constraint, which is this button right here. Something. You can always add rigid body constraints on the
objects, but it is highly, highly recommended that
the best way to add rigid body constraints is to add them using empty objects. Here's what I mean.
I'm going to select this metal head and
hit Shift S and cursor to select it to move the three Dcursor in the
center of this hammer. The main reason
I'm doing this is to just add an
object right there. Next, I'm going to go Shift A, and let's add an arrow. I will have this empty object, which is just a
very simple arrow. Next, I'm going to add to
it a rigid body constraint. For the type, you will have
all of these different ones, and we will explain each one of the the first one that we
care about is the fixed, and a blender will tell you
glue rigid bodies together. So it is a way to combine or
glue two objects together, even if they have different rigid body systems
added to them, which is the exact
situation of this hammer. So I will keep it at fixed, and you will have here
objects where you need to select the two objects
that are joined together. So the first object will be the wood handle and the second object will
be the metal head. And now you might wonder, but, hey, why are you using
an eptune object? Here's how you should
always think about it. The empty object is where
the relation is happening. When I put the rigid
body or sorry, when I put the arrow in the
center of this metal head, that's where the
relationship between those two objects is happening. But it is important
that I mentioned, I'm just saying that
to explain it to you. I can even move, for example, this empty object, and the
relation will stay the same. The location of this
empty object doesn't matter in this situation
for the fixed constraint. So in general, we use
empty objects as holders for the information that defines the relation
between two objects. So now if I go to
frame number one again and hit play,
notice what will happen. Now the hammer
will fall in a way more realistic way because
when we join them, right now, the head will have a certain mass and the wood handle will
have a lighter mass. And that way, we can have a
really realistic simulation. So this is it for the fixed
rigid body constraint. Whenever you find
yourself trying to glue two objects together, use the fixed constraint. Right now, let's talk about
the point constraint. The point constraint is a way to link two objects
in a way that will allow any kind of rotation around the location of
the constraint object. You can think of the
point constraint as a metal rope or a metal bar
that connects both of them, and in one end, it is
allowed to rotate. For example, it can
rotate around this point, but from the other side
right here, it is welded. This cube will be able to swing back and forth and all
the different directions, but it won't be able to rotate, for example, around
the center right here. Meanwhile, this metal bar will be allowed to
rotate around here. That's how you should think
of the point constraint. I'm going to hit
Control Z to remove all of my garbage drawings, and let's start creating
this constraint. Let's add a rigid body to
the support and make it a passive object and for the
shape, turn it into a box. And for this metal cube, add a rigid body to it, it should stay as
an active object and for the shape also
change it to a box. And now we can move on to
creating the constraint. Something I always mentions
is that whenever you find yourself trying to create
a rigid body constraint, I would highly
recommend that you create them using empty objects. So now we should ask
ourselves if we were to connect both of these
with a metal R, where should it rotate around? I want it to rotate around
the center of the support. I'm going to hit Shift S
and cursor to select it, and the main reason I'm
doing that is to move the three Dcursor to the
center of the support. So when I add the arrow, it will basically be
added right there. Go Shift A, arrow, rigid body constraint, change the type from
fixed to point. And if you hover
over it, you will have the definition constraint rigid bodies to move
around common pivot point. So select point. For
the first object, you can select the support. For the second object,
you can select the cube. If I hit Play, nothing
will happen at first, but if I go to frame number one, I'm going to select this cube
and then hit J to move it, and now hit play. Notice what will
happen. Cube will start rotating or start pivoting around the center
where the arrow is. If I move the arrow
by hitting J, for example, and moving it here, notice how it will rotate. Right now, it will
start rotating around the center right here. I'm going to go back to
frame number one right now, and while you're
selecting this cube, hit l J to resist the position, J Z, and let's move it. For example, 5 meters
up in the air. But in my situation,
let's say I also want the pyramid to
rotate around this cube. While you're
selecting this cube, I'm going to hit Shift
S, cursor to select it. To move the cursor
there, shift A, arrow, add a rigid
body constraint. It should be a point
for the first object, it should be the cube and for the second object, it
should be the pyramid. And I also need to add a rigid body system to the pyramid. Rigid body should be an active object, keep
it the way it is. And for the shape,
is there a cone, we can choose cone, but it doesn't look right
because it is from there. So yeah, let's keep it at
cone. It's not a big deal. And now if I hit J and move it here, notice
what will happen. Both of them will start
rotating in this weird way. Actually one thing you can do, you can select this empty
object, the second one, shift select the cube, control P to pair in them, and choose the option object. And now this empty arrow
will follow the cube, and since it is hooked to this constraint
controlling the pyramid, notice how everything
will look like at play, and you will have
something looking like so. This is the point constraint. Think of two objects that are
connected with a metal bar. From one side, they can rotate, but from the other side, it is welded, so
they can't rotate. And the end where
the metal bar can rotate is where this
empty object is located. Hello and welcome to
the hinge constraint. As the name states, it is a way to rotate one object
around one other. There will be no movement or translation, just pure rotation. In our example, we
have the cylinder, this lever, and this lever. And what I want to do is to make this lever spins around or
rotate around the cylinder, and this lever will rotate
around this other lever. On a point somewhere right here. So how can I create
such a thing? Well, this is simple. As usual, if you want
to create a constraint, I would highly recommend
that you create it using empty
objects or arrows. In my situation, I'm
going to go Shift A, and let's look for arrow. By default, it will be added in the center of the scene
where the three Dcursor is, which happened this time to be the same exact center
of the cylinder, which is exactly what I want. I'm going to hit
S to scale it up. This won't change anything. I'm just doing this to
make everything clear. I'm going to select the cylinder let's add a rigid body to it. It should be a passive
object and for the shape, turn it into a box. Or, actually, no, you can
turn it into a cylinder. Next, let's move
on to the lever, which is this bad boy
right here, rigid body. It is an active object,
and for the shape, let's make it a box because
it is way, way simpler. Now we can move to
the constraint, select the empty object, rigid body constraint, change the type from fixed to hinge. And if you scroll down, you
can select the two objects. So first, let's
select the cylinder. Next, let's select
the lever one. Now if I hit play h
will work. Why is that? Right here, you will have
something called limits angular and you will have a
check box called Z angle. The hinge constraint
works based on the Z axis of the
object it is added to. I'm going to check this
box, and right now, this constraint is calculating everything around the Z
axis that is right here, which is not exactly what
we want. Why is that? Because the axis of rotation
between these two object, it is the Y axis. So what you should
do in this situation is we need to rotate this empty object so that the Z axis will align with
the axis of rotation we want. This is actually really simple. While you're selecting
your empty object, hit R X and 90. We'll rotated this empty object around the X axis 90 degree, which will make
the Z axis aligned with the axis where we want
the rotation to happen. Now if I go to frame
number one and hit Play, Blender will crash. This is a common thing
you will always find yourself dealing with
when it comes to simulations and blender
because blender is not that stable when
it comes to simulations. Okay, so I rebuild the exact
same system we had before, and this time, if I hit Play,
notice what will happen. It will rotate around the Z
axis of the empty object. These Z angle values will
allow you to control how much flexibility or what
is the range of rotation? If I turn this, for example, two -90 and this one to 90, go back to frame number
one and hit play. This will allow for more
freedom and rotation. You can even make this 150, and this will give you
more freedom and rotation, and it will eventually go back. Which is exactly what I want. Let's try right now to add the same exact constraint
to this one right here, so it will rotate
around the other lever. This should be really simple. Let's start by adding
a rigid body system to the lever number
two, rigid body, change the type from active or actually keep it at
active and further shape, transform it into a box. Next, ask yourself, where do you want this bad
boy right here, the lever number two
to rotate around? Should rotate around an
axis somewhere right here. So let's go Shift A,
look for an arrow. By default, it will be in
the center of the scene. Hit seven from the
number pad to jump here and let's move it
somewhere around here. This is where I want
the rotation to happen. Seven again, and
let's put it here. This seems about right, JY, to move it slightly
here and always remember when I will add
the rigid body constraint, change it to hinge. Everything should be
aligned with the Z angle. What is the axis
I want to rotate? It looks like this, but the Z axis is pointing
up right now. So let's select
this empty Rx 90. So now the Z axis is aligned with the axis
of rotation I want. The first object is
the lever number one, and the second object is
the lever number two, and as usual, the
order doesn't matter. Now if I hit play,
notice what will happen. They will rotate in this
really, really nice way. Now, of course, since this empty object is
stuck right there, in case I also wanted to move
with the lever number one, say they will look connected, I need to select, first of all, the empty, the second empty. Next, shift, select
the lever number one, Control P, and parent
it to the object. So right now, this empty object will follow this while rotating. If I hit play, you will have
something looking like so. The effect is not
visible because if I jump to the second constraint, as you can see, I
didn't allow for a great level of freedom when
it comes to the rotation. I'm going to turn this
to -90 and this to 90, and this should give us
a way better result. Let's even make it 180. Go back to frame number
one and hit play again, -180 here at play. And as you can see, this
is looking really sick. So yeah, this is the
hinge constraint. It is a way to
rotate one object or round another using an axis. The easiest way to remember the rotation axis is to
look at the constraint, and you will see Z, which
means that the Z axis of the arrow object should be aligned with the axis
of rotation you want. Let's move on right now
to the next constraint. Hello and welcome to
the Sluter constraint. We have also another
basic scene. We have this rotating plate
which we will make rotate. We have this lever, which is connected to the rotating plate, and also it is connected
to this metal cube. And this metal cube will slide inside this canal
of the wood piece, and we will actually be creating more than one constraint, and this will be a
really fun exercise to understand exactly what
the slter constraint do. So first things
first, let's make this rotating plate rotate. This should be really simple. I will jump to the object
properties, and from here, I'm going to add a keyframe to the rotation on the Z axis. Next, change this timeline
from the timeline to the curve or the graph
editor, jump to modifiers. Add a modifier generator, which will make this plate
rotate extremely fast, and I'm going to make
it, for example, 0.05. And now if I go back
to frame number one, it will be rotating like this, which is exactly what I want. I'm going to go back to
the timeline First of all, we need to create
a constraint that connects both the lever
and the rotating plate. Make sure to select
the rotating plate. Shift S, cursor to select it to move the
three decursor there, Shift A, and let's
look for an arrow. And we want this arrow
to be located in the point of connection between the lever and the
rotating plate. I'm going to hit seven from the number pad to
jump to the top view, move it around here, also hit three to jump
to the side view, J, and let's put
it. Around here. This is where both of these
two objects will connect. Now, you should ask yourself, what is the relation or what
is the type of connection between both the rotating
plate and the lever? The rotating plate
will be rotating, so we want this to also
rotate with it, just like so. So how can I build such thing? Well, this should be simple. By adding a rigid
body constraint to this empty object,
rigid body constraint, and for the type I want it to be point because
as you remember, a point will allow me to connect two objects
around one point, which will allow
for some rotation. Meanwhile, if I
keep it at fixed, that will not allow the
rotation to happen. That's why I need
to choose point. Nothing will happen, of course, right now because I need to add a rigid body system to
both the two objects. Let's select the rotating plate. Add a rigid body to it. It should be a passive
object and it is animated, and for the shape, it
should be a cylinder. For this lever, select it, add a rigid body to it, it should stay as active, and for the shape, let's
keep it at convex hole. You can even choose box if you want something
that is more simple. Now if I hit play, notice how it will look,
I will fall down. Why is that happening? Because this constraint
is not working yet. We need to choose
the first object, which is the lever and
the second object, which is the rotating plate. And since I don't want both of these two object to
interact with each other, I just want to take the rotation of this and apply
it to this one. Going to select the constraint
or the empty object and you can disable the rotation or actually disable
the collision. That will lead to a
more stable simulation. If I hit play, notice
what's happening. Next, I need to connect the lever with this
metal box right here, select the cube, Shift
S, cursor to select it. Shift A, let's add an arrow. Where does the
connection lies between both the lever and the cube
should be around here. So make sure you select
to empty, put it here. Hit seven to jump to the top
view, and it should be here. Next, let's add a rigid
body system to the cube, rigid body, it should
be an active object, and for the shape,
keep it as a box. Select the constraint or
the second empty object. Rigid body constraint also should be a point,
disable collision. First object is the cube, second object is the lever, hit seven to jump
to the top view, and if I hit play, it
will look just like so. This is not what we want. We
want this cube right now to slide along this bad
boy along the canal. So select the canal, add a rigid body system, and change it to passive, and for the shape, make it mesh. And what is the relation between
this canal and the cube? It is a sliding relation. That's why you need
to go Shift A, and let's add another arrow, which will be the
third constraint between both the
canal and the cube. Make sure to select
it. And even you can hit F two to call it slider. Rigid body constraint,
change it to slider, and you will have
X axis right here, which means that this constraint should work along the X axis. In other words,
Blender will make the sliding process happens along the X axis of
the empty object. So we need to align
the X axis along the axis where we want to do the rotation or
actually the sliding. We want the scope to
slide along this axis, but the X axis of the empty
object is pointing this way, so we need to
rotate it this way. This should be
really simple while you're selecting your
slider empty object, RZ and do 90 and this will make the X axis of the empty object aligned with the
axis of sliding. Next, you can check X axis. Next, first object
should be the cube. Second object is the canal. Maybe you can make these minus
two to two just in case. And now if I play,
notice what will happen. This cube right now is
sliding in the canal. Right now, I want to explain some important concepts that
you need to keep in mind. When we are creating
this simulation, there are things that you
need to keep in mind. Yes, the scene is about
creating a slider constraint, but we're also creating
other types of constraints. The constraint connecting
both the lever and the cylinder is a 0.1. Same thing for the
constraint connecting the lever and this cube,
it's also a point. That's why it is important
to always ask yourself, what is the relation between
both of these two objects. You need to go
sequentially and define the relationship between
each two objects. We started with the rotating
plate and the lever, we defined it as point. Then we went to this
lever and the cube. We also defined the relation
between them as a point. And next between the
canal and the cube, we also defined it, which
is a sliding constraint. Should always define the
relation that is connecting two objects that will directly
interact with each other. The rotating plate
and the lever, they interact directly
with each other. That's why we created
a constraint. Meanwhile, this lever
and this canal, they don't interact directly. This cube and this canal, they are interacting directly. That's why we created
a constraint for them. You should always
define for blender, the relation between two
objects that are interacting directly when
creating these sort of rigid body constraints. So yeah, this is it for
the sliding constraint, and I will see you
in the next one. Hello and welcome to
the piston constraint, which is really similar
to the slider constraint. The difference is
that a piston permits translation along the X axis
of the constrained object, and it also allows the rotation around the X axis of
the constraint object. So the really nice thing about it is that it is
a combination of the freedom of the
slider constraint and also the hinge constraint. So it's like it is
combining both of them. I have this really basic scene, and the only thing I did is that I created this small canal, and I added to it a
couple of keyframes, so it will swing back
and forth, like so. I also have this metal cylinder, which is this weird
shaped cylinder. And what I want to do is to make it slide along this canal. So let's start doing that, and I will show you
later the obstacle. First of all, I'm going
to select the canal. Let's add a rigid
body system to it from the physics
stab, rigid body. For the type, it should
be a passive object and it is animated. I'm going to keep the
shape set to convex whole. Next, let's move on to
this metal cylinder, add a rigid body to it. It should be an active object, and for the shape, make it mesh. Now, by default,
nothing will happen, and everything will explode. So what I want to do is to right now create the
constraint I want. Where should be the location
of this constraint? Well, the thing that
makes the most sense is in the center of the
cylinder, the metal cylinder. Shift S, cursor to
selected, Shift A, and let's look for an arrow, add the rigid body
constraint to it. It's not visible yet
because it is too small, so S and let's skate
it by a factor of six. So now everything is visible, and let's change the type
from fixed to piston. Right here, you will have
the X angle and the X axis. The piston constraint does have a similar concept to
the slider constraint, which is that everything will be calculated based on the X
axis of the empty object. So the sliding will be along the X axis of the empty object, and also the rotation will
be around the X axis. So for example, if both of these two objects
were rotated like this, so I will need to rotate the empty object so
that the X axis of the empty object
would be aligned with the direction of
sliding and rotation. Let me go back to
the constraint. You can check X
angle and X axis, and let's make this
minus ten to ten because both of these
two objects are huge. Next, change for the
object number one. You can pick the cylinder, and for the second object,
it should be the canal. And now hopefully everything will start sliding
like a piston. If I hit play, this will happen. And now you might say, Hey, sin, this is looking exactly
like a cylinder. But actually, if I
show this obstacle, which is this small
cube right here, and it doesn't matter that it will clip with the wood piece. This is not the point, but
I'm going to select it and add a rigid body to it
and change it to passive. And let's change
the shape to box. Now, if I go to
frame number one, let's hit play again. Notice what will happen when this cylinder will
collide with this cube. As you can see, it
will push it away. Let's see it again
by going back here. Yep. As you can see, this blue box is pushing the
metal cylinder away from it, so it is interacting with it. And this is the
rotation component of the piston constraint. The sliding constraint,
as you remember, is just about translation
along the X axis. Meanwhile, the piston constraint will also allow the rotation of the object along the X
axis of the empty object. I hope that makes sense. Of course, you have a couple
of more settings right here. You can control how
much rotation you want. It's like you define
the limits of rotation, which is angular and
also you can define the limits of translation
on the X axis. If I just reset these to the default values
minus one to one, you will notice that the metal cylinder
won't slide as much. Let's go back to frame
number one and hit play. It barely slides. Let's wait for it to go
back, and it will stop here. So by increasing this range, you increase the range of
motion of the sliding, and by increasing this value, you increase the rotation. Play again, and it
will slide back. Why isn't it not sliding? That's weird. Oh, okay, because I said this to the upper also to minus
ten, it should be ten. Let's play again, and everything
should work smoothly. This is it for this constraint, and let's move on to the next. Hello and welcome to
the generic constraint. I have this wood tube, which I know is not realistic, but it is what it is, and
I have this metal object. I'm going to add a couple of
rigid body system to them. I will start with the wood the
or add a rigid body to it, change it to passive, and for the shape,
turn it into mesh. Next, for the metal thing. Add a rigid body to it, keep it as active because I want it to move and
rotate and all of that. For the mass, let's
make it 20 kilograms, and for the shape,
make it a mesh. Now if I had play, this
is what will happen. I will slowly rotate
and all of that. Okay. Now let's try to add
the generic constraint. I'm going to go Shift A, and let's add an arrow as usual, and let's hit S and
scale it five times, it will be really
visible, and by the way, scaling the empty object
will not change the physics. The generic constraint is a constraint which allows the
user to clamp translation and rotation of any axis between two selected rigid bodies.
What does that mean? So I'm going to
select this empty, add rigid body constraint, and let's change it to generic. Right here, you
will have limits, and I will go back to
these tabs in a second. First object should be the wood and the second
one should be the metal. If I hit play, this
is what will happen. Somehow it looks like
these two objects are not interacting with
each other anymore, and this is where
the limits comes in. The generic constraint
will allow me to clamp the angular
and linear limits, which means how much rotation you want on each different axis and how much translation you
want in each different axis. For example, let's say
I want this metal piece to only rotate
around the Y axis. So how can I do such thing? Let me go back to
the constraint, and I'm going to close all the angular things or actually disable the Y angle because I don't
want to close it. And I'm going to
turn these to zero. And this one to zero. So right now I'm clamping the X rotation and the
Z rotation to zero, so there will be no
rotation along the X and Z. Let's say also I don't
also want it to move. And that's what
will allow me to do this by closing all of these ones and I'm going
to turn them all to zero. What's happening right now is that I'm telling
Blender that, hey, for the linear, on the X axis, it is zero, so don't
do any movement. On the y axis, it's the same. Don't do any movement because the lower and upper
are set to zero. Same thing for the Z axis. So it allows you to control
the range of movement. When you check that box,
you're telling Blender that, Hey, blender, I want to
clamp this property, and once you clamp it, you can pick the values, and if you set
them both to zero, this will literally act
like a point constraint. That's the main logic behind
the generic constraint. It allows you to control how much rotation and how
much translation there is. And if you set them all to zero, there won't be any sort of
translation or rotation. So now if I hit plane,
notice what will happen. I will only have the rotation
going on, and of course, the blender needs to
go sometimes hey wire, but that's the main concept behind the generic constraint. And I'm not sure if I check
or disable collision, that should maybe, okay, this will cause it to
be even more unstable. So yeah, this is how the
generic constraint works. Next, we will move on
to the next constraint, the generic spring constraint. We have these two balls. We have this spring pad, which will make it
act as a spring. We also have the
floor. First of all, let's start by adding the different rigid
body systems we need. For the floor, jump
to the physics step, rigid body, it should
be a passive object. For the spring pad, add a rigid body, keep it as active
and for the shape, make it a box since
it is really simple. For the two spheres,
add a rigid body, let's keep the
weight the way it is and change it from
convex hole to sphere, and same thing for this one, add a rigid body
with a sphere shape. Now, if I hit play, here's
what will happen. Very basic. What we want to do is to
make this spring pad, this metal box,
act like a spring. So how can I do that?
Well, that's simple. We need to add a constraint,
called spring constraint. How can we add a constraint? At this point, it should
be super clear. Shift A. Let's add arrows, scale them, let's say by a factor of three, just for easier readability. Rigid body constrain. And change it from fixed
to generic spring. I will go back to these
settings on top in a second. First object should be the pad, and the second object
should be the floor. If I hit play, here's
what will happen. Everything will fall down.
That's not what we want because we need right now
to enable the spring. First of all, make sure
to disable the option, disable collision because right now there is no
collision happening. If this box is checked, there won't be a collision. So enable the collision
by unchecking the box. I I hit play, everything will keep functioning
the same way. So now the question becomes, how can we enable the
spring constraint? Well, right here you will have all the different settings
related to the spring. You have the angular and
the linear settings. The angular ones will
control the rotation of the spring and the linear ones will control the
translation of that spring. I'm going to enable all of them, and now if I hit play,
notice what will happen. It will fall down because the stiffness and the
dampening are super low. So here's what I
will do. I need to increase all of these
different values. Let's say 200 here. Same thing for the Y stiffness and same thing for
the Z stiffness. Also make it 200 here, 200 on the Y axis for the
linear and 200 also here. And for these values, let's
make them, for example, 50, 50, 50 dampening. Let's make it two, two, two. I got to these values when I was experimenting
with the scene. So play with your scene until you find the values
that works for you. But these are the values that control the strength
of the spring, the stiffness and the dampening. The stiffness, as
the name states, controls how stiff
that spring is, and the dampening is how fast that spring will go back
to its original position. So stiffness is how hard that
spring is to actually move, and the dampening,
how fast it will bounce back to its
original shape. If I hit play, now
we have spring. These are the most
important settings by far when it comes to
the spring constraint, because you can control the
stiffness and dampening on an angle base for the rotation and on a linear
base for the translation. You will also have a couple
of more settings on top. You will have the limits for
the angular and the linear, which is a way to clamp how much rotation how much
translation there would be, which will allow
you to control or to clamp how much rotation you want to be or how
much translation you want to be in
your simulation. These are settings that
are really similar to the generic constraint
that we just explained. And lastly, you will have
the disabled collision, which is also useful option, which to explain it, I'm going to jump to the
sphere and make the mass, for example, 100 kilograms. Now if I hit plane,
notice what will happen. The spring will
fall down because it can't handle the
100 kilogram bowl. Right now, the option for
disabled collision is enabled, which means there
won't be collision. There won't be collision between
10. Building Destruction: Building distraction simulation. Hey, everyone, and welcome back. This is the third exercise, and probably it is also the
most complex one so far. We're going to take everything we've learned so far and put it into practice by creating this building
distraction simulation. You will learn a ton
throughout this video, and hopefully it will
deepen your understanding of the world of rigid body
simulations and blender. So yeah. Let's get started. Hello and welcome back
inside with a blender, and the first thing I want
to start doing is to take a general overlook on how
this blender filed works. The blender startup file for
the building destruction. You will have three
different collections. You will have the top level, which does have the
model of the building, which is this one right here. You will also have the
frames or actually, sorry, this is the glass,
and you will also have the frames, the
metallic frames. You might be
wondering, why did I separate them in this fashion? Main reason is because
we'll be running a different simulation for
each group of objects, which means that
for the buildings, we will run a simulation
just for them, same thing for the
metallic frames, and same thing for the glass. And that's why I separated them into different collections. The other ones, middle level and bottom level are just some
variations of this level. So if I just disable the top level for a second
and enable the middle level, these are the levels that will be in the middle
of the building. They are the same exact
thing as the top level. The only difference
is that if you notice the top level does have
this rim edge on the top. Meanwhile, the mid
level don't have that. Other than that, everything
else is the same. We separate the building, we have the glass, and we
have the metallic frames. The collection that is
slightly different, it is the bottom
level because it will have this entrance
right here, okay? With the glass and the frames
of the windows separated. Each one of these objects, I remember using the mirror
modifier to build it. So if I just head
tap for a second to jump to the edit
mode, as you can see, I only modeled half
of the building, and the mirror modifier
is taking care of reflecting that
on the other axes. And that's how I built all
the different buildings. Something else you
might notice is that these buildings are
not really optimized. We have a lot of
edge loops going. Main reason for
that is generally, the more vertices you
have in your object, the more you will be able to fracture it into
different pieces. That's why I chose to add
a lot of subdivisions to buy buildings so that later when I'm doing
the fracturing process, I will have more pieces, which basically will make the simulation slightly
more realistic. Same thing for the bottom level. This is the frames. Also, the frames does use the mirror modifier, same
thing for the glass. Later on, we will
be applying all of these different
modifiers because we cannot fracture the building
with the modifiers on. Now let's talk a little
bit about the materials. So each one of
these objects does have different
materials added to it. Let's start with
the building model. These material are common in all the different
levels, by the way. So for example, for
the bottom level, you will have the
white concrete, let me just jump really
quick to the tv mode. The white concrete is the color that is on
the outside, okay? The painting concrete this blue. Interior walls is the
color inside the building. It is almost white. The only difference is
that I added a hint of cien to it just to
separate it a little bit. And the inside, we
cannot see it right now. But imagine later when we
will fracture the building, we will have different pieces. The interior faces or the inside of those different blocks
will have this color. And that's, I think the
color of the concrete, okay? This will be really
visible later when we fracture the building
into different pieces. The frame does have a
very simple window frame that is a metallic material. It is really simple.
For the glass, it is a very simple
glass BSEF added to it. The materials are really simple and they are not the main
topic of the course. That's why I chose to keep them simple and
straight to the point. So now let's start
working on actually creating a building
and destroying it. But first, let's
create our building. The concept is really simple. We will be duplicating the middle level on top
of the bottom level, let's say five or six or
seven times and on the top, we will put the top level. But before we do that,
I would love to apply, first of all, the modifiers. Let's, for example,
select all of these. Let's start with
the bottom level. And if you go to modifiers, either you can apply
object by object, but there is another way
which is if you select all of these objects and
then go to object, convert to mesh, this will apply all the
different modifiers. Let's also enable the collection for the middle level
and the top level, select all of these objects,
object, convert, mesh. This is the easiest way to apply modifiers on multiple
objects at once. Next, let's start
duplicating all of these different objects
to create the building. I'm going to start
with the middle level. By default, it is perfectly
overlapping the bottom level. And that's not what
I want. I want to shift it a little bit up. When I was modeling all
of these buildings, the height of each
building is 4 meters. If I just select, for example, the middle level and hit
N to open the side bar, as you can see, it is 4
meters on the Z axis. So if I select all of these
objects and then hit JZ and shift it by 4 meters they will be perfectly on top
of the bottom level, but there is something
I want to mention. If I just hit enter to
confirm this movement, now the building is perfectly sitting on the bottom level, and that later might cause some problems regarding
our simulation. It is highly recommended that when you have
multiple objects that are stacked on top of each
other to leave a small gap, it won't be noticeable
in the render. But it will help blender when it comes to
running the simulation. That's why I'm going to control Z to cancel this movement
that I just did. Head JZ to move it
also on the Z axis, and instead of typing four
to shift it by 4 meters, I'm going to type 4.01. I will be leaving a gap of zero 1 meter or
actually 0.0 1 meter, which is 1 centimeter between the different levels. Type 4.01. And if I hit one to jump to the front view, as you can see, it is not the visible which makes me think that maybe
because of the top level, the top level does
have that ring. That's why it was hiding
this gap between them. But yeah, this is
the main concept. If you did everything
right now if I select all the different objects inside the middle level and
then hit Shift R, nothing will happen
for whatever reason, so I will also need
to do it manually. Hit Shift D to tuplicate it, to only move it on the Z
axis 4.01 to shift it by 4.0 1 meter in relation to the previous position and
then hit you can see, right now, we did
everything all at once. We hit Shift D to duplicate, shifted it on the Z axis,
and then confirmed. This will allow me now if I hit Shift R to repeat
the last process, this will automatically redo
the same steps that we did. All you need to do
is to hit Shift R until you have the number
of levels you want. I'm going to zoom
out a little bit, let's say shift
Rshift Rshift Rshift RShiftR we do the job. So now we have one, two, three, four, five, six, seven, eight, but we need to
put the top level on top. So it is still sitting at the bottom of the building,
so we need to shift it up. So the question now becomes
by how much, which is one, two, three, four, five,
six, seven, eight. So eight multiplied by 4.01. If I open the calculator
and I do eight multiplied by 4.01,
that's 32.08. But because we need
to also leave a gap between between it and
the level beneath it, it will be 32.09. Select all of these JZ, 32.09. Just by doing this, now we have this model of the building
that we will destroy. Right here, I did
a small mistake. The top level right now is sitting on one
of the mid levels. To fix that, make sure to offset the top level by
a value of 36.09. Later in the video, I will discover that
mistake and fix it. But for you, you
can fix it from. Now the last thing,
I want to reorder my outliner because that's
not the structure I want. I only prepare the structure
for creating the building, but we're going to change it. We want the frames to be
on their own collection, same for the glass, and same for the concrete buildings.
This will be really simple. If I go to the search and type, for example, frame, I
will have all of these. So just hit A to select
all of the frames, hit M to create a
new collection, hit N for a new collection, let's call it frames
and hit Create. So now we have a
collection for the frames. Next, let's type Glass. Blender will show me
all the glass objects. So hit A to select or sorry. Let's hit A to select
all of the glass here. M, new collection and type
glass and hit Create. And last thing, let's
look for level. I will have all
of these objects. Hit A to select everything,
M, new collection. Let's call it buildings
and hit Create. And let's disable the research. And that's how I
separated all of these different objects to their own different collections. And actually, I can delete these three collections
at the bottom, the middle, and the top level. And if you want to
go a step further, you can create a
new collection and let's call it windows, move the frames collection
inside windows, and move the glass
collection inside windows. So this is the
structure I'm going to use start as of now, one thing I just noticed
is that apparently, there are two levels
overlapping on top, and my theory is
that the top level is actually overlapping
another level. That's why I'm going to jump to the building, the top level. And as you can see, it is
over one of the middle level. That's why I'm
going to hit J Z to me on the Z axis, 4.01, and now it will be
sitting perfectly on top, and it seems like
I will need to do the same exact thing
for the windows. So let's jump here, select the glass
and the windows, J Z 4.01, and they
should look perfect. Also, the other thing
since earlier when we were using the search process, when we type frame
and you type level, also there is this frame and
glass of the bottom level. They are not in their
corresponding collection, so let's take the glass
and move it to the glass. Take the frame and
take it to the frames. And now our structure
is perfect and we're ready for starting
to fracture the pieces. Since this video will
be on the longer side, I would highly advise that
whenever you see these chapter breaks that you save your
file, save incrementally. Next, let's move on to
fracturing the building. First, I'm going to disable the Windows collection because
I don't need it for now. I only want to leave
the concrete building, and for fracturing the building, we're going to use an add
on called cell fracture. So the first step will be to enable the cell fracture add. To edit preferences,
and you can go to get extension and look
for cell fracture. You will have here an
install button or update button depending on whether you installed it before or not. So just click on Install, and it will be added to your
computer. It is that simple. Once you install it, go here and click on Save preferences,
and you're good to go. Now we can fracture
the building. What I will do is to select
this entire structure called buildings by double
clicking on the collection. Then go to Object. Quick effects. You will
have here cell fracture. Click on this and let's
start talking about the different settings that
this add on will give us. Cell fracture add on
will take a model and fracture it into
different pieces. But there is an important
question that we need to ask ourselves how to control how
many pieces there will be? Well, the point source is just a way to tell
the cell fracture, add on how many pieces we want. Own verts will use the
number of vertices that form your object as a
number for how many cuts. If your object, for
example, has 200 vertices, then the cell fracture add
on will try and divide it or break it into that
number of different pieces. Child verts, in case you have a parent object and
a child object, it will fracture the
parent object based on how many vertices and the
children object on particles. In case you do have
a particle system, you can use this option, child particles in case you have a particle system on
the children object and the annotation pencil in case you draw with the
annotation pencil, you can basically specify
where you want the cuts. Source limit is how many
points or what is the limit. For example, let's say
you do have 1,000 points. So the cell fracture
add on will try to break the object into
1,000 different pieces. You can specify, like, Hey, I only want, for example, 100. And the noise is just
an option to randomize the fracturing process or randomize the point
distribution, as you can see. In our situation, I'm
going to choose own words. And as you remember, I mentioned intentionally
made a lot of subdivisions in
the building model to have a little
bit more pieces, so that should make
the simulation slightly more realistic. And for the source limit, let's just increase it
to something like 500 and bring the noise up
to one to make it uneven. Recursive shatter
is just a fancy way to tell the cell
fracture add on, for each piece, please
also divide it even more. And that's what this
recursion means. And most of the
time when I use it, I end up with a result
that looks slightly like just using
the point source. So that's why we're not
going to touch this. We're going to leave
it the way it is. Next, let's talk
about mesh data. This is important. First
of all, smooth interior. When using the cell fracture add on and we're
talking about interior, we mean the interior faces
that we can't see right now. So smooth interior, we set the inside of those different
pieces to smooth shading. For the material, we also can specify the materials
of the inside. And if you remember, if I just leave this for a
second and jump to, for example, one
of the materials, you will have here the inside. So we want to assign
the inside to the inside of these
different pieces that we will have later, okay? We go back to selecting
all the different objects, object quick effects,
cell fracture, and by default, this anon will forget the
different values. Onwards, 500 and
we're good to go. For the materials, we can assign which material we want to
be the inside material. It starts from zero. So this
is zero, one, two, three. So from here, bring
this to three. So Blender will use
the inside material for the inside faces. Sharp edges will set the
edges to sharp, not smooth. Interior V group or interior
vertex group will create a vertex group for
the interfaces in case later you want to change the material
something like that. This can be really
useful. So I would highly recommend that you always
enable this option. Next, we will keep all of these different settings
the way they are. And for collection, we want all the pieces to be inside
a certain collection, so we don't overcrowd
our outliner. That's why I'm going
to create a collection called building and
rescore pieces. Or let's just call
it pieces directly. And once you have your
settings dialed in, just hit Okay, and Blender will start
fracturing the building. This will take a little
bit of time depending on how many pieces you will
have in your building, but it some time, and I will see you
in the next step. Okay, Blender just finished
the fracturing process, and I will have this new
collection called pieces. And if I just collapse
it, as you can see, it does have over 5,000 pieces, which makes sense because our buildings does have a lot of vertices and a
lot of subdivisions. Anyway, I'm going to
take the pieces and bring it outside the
buildings collection. For this building collection, I'm going to create
new collection, let's call it, for example, archive to store the objects
that we don't need anymore, and I'm going to take the
buildings and bring it inside the archive and
disable this collection. So now, this is
our new building. And if I zoom in a little
bit, as you can see, the building is fractured into
a lot of different pieces, and the inside is
now the dark color, and that's what I meant by
the inside of those pieces. Control Z to cancel. And yeah, this is it for
how to fracture the pieces. Next thing, we will make
this building four. How can we do that by adding a rigid body system to all
of these different pieces? Double click on the
pieces selection to select every piece, go to object, rigid
body, add active. And this will add a rigid body to all the different
pieces, as you can see. If I jump to the physics tab, every piece right now will have a rigid body system added to it. And now if I hit play, everything should start falling. It is starting to fall slowly, but because the simulation is really heavy on the computer, that's why from the beginning, I need to add a surface or a floor for everything
to interact with, okay? Let's go Shift A, mesh plane. And for the size, let's
make it, for example, 100 meters or let's
say 150 meters. And instead of leaving it
as just a simple plane, I'm also going to hit tab
to jump to the edit mode, and let's extrude it
a little bit down. This should technically make
the simulation slightly more stable because the plane by default is infinitely thin, and that can cause some issues. Heat tab to exit the edit mode, and let's make sure
that the origin set origin is in the
origin to geometry. So the origin will
be in the center. Rigid body to this plane
and change it to passive. And while I'm selecting it, I'm going to hit M to move
it to a new collection. I'll create a new one and
call it floor and hit Create. And now, if I hit play, the building should start
falling on this plane. The building now directly falls, but we want to stay in shape in the beginning and then
at the moment Notice, it will start falling. So how can we control when the building
will start falling? We need to add a
collider object. I'll explain what
I mean. I'm going to go back to frame number one, and let's select all the
pieces by double clicking on the collection and just select randomly one of those
different pieces. Let's next jump to the
physics Sab dynamics. Deactivation. Right
here, you will have a check box
called deactivation, which basically means that in the beginning
of the simulation, the simulation will
be deactivated, and it will only start unless
you disable this option and check this option or in case there is an object that
collide with the building. So we need to check this box for all the
different pieces. That should be really simple. Make sure to hit Alt and
then click on deactivation. Next also while you
are hitting Alt, click on Start deactivated. By hitting Alt and checking something
or changing a value, you will be applying the setting to all the different
objects all at once. Now if I select randomly
another piece, as you can see, deactivation checked,
start deactivated check. And if I hit Play, nothing
should happen right now. And as you can see, the
simulation is already running faster because
nothing is happening. So the question now becomes, how can we start the simulation? We need to add an object
that will collide with this building to start
the simulation process. So to do that, I'm going
to go Shift A, mesh, and let's add, for example, an ICosphere or a sphere. It doesn't matter. For the sign, let's make it 5 meters. So it is here in the center, JZ and 5 meters to
move it 5 meters up, so it will be perfectly
sitting on the ground. Let's hit seven to
jump to the top view. Let's just jump to the irregular shading so we can see everything
in a better way. And what I'm going to do
is to animate this sphere to collide with this building to start the
destruction process. Okay? So on frame number one, let's say it will be here. Hit K to insert a keyframe for the location,
location. Move on. Let's say, for example, 20 frames and J, and let's move it
inside the building, as you can see right here, seven for the top view, K, insert another keyframe
for the location. By default right now,
nothing will happen because this kosphere doesn't have a rigid body system added to it. So first of all, let's select it M,
new collection. Let's call it collider. Create. For this icosphere, add a rigid body to it. It should be an active object. And since we want to animate it, use it keyframes, make
sure to check animate it. And for the shape,
change it to sphere. Now if I just go here and let's see what will happen when the simulation
starts. Let's play. The building will start falling. But for now, that's not what
I want because actually, that's what I want, but there is a slight problem
that we need to fix. Basically, this cho sphere, after it collides with the
building, it will stay there. So all the different pieces will fall in this direction
and this direction. We don't want that. We want the sphere to disappear
at a certain moment. That's why while I'm
selecting this sphere, let's say I want to
start scaling down to zero once it collides
with the building, which means I'm
going to hit seven to jump again to the top view. And let's say, starting
from the moment it starts colliding with
this building around here, going to hit K to insert
a keyframe for the scale, and once it fully collides with the building
somewhere, let's say, around frame 25 S zero, I'm going to scale
it by zero and K to insert a keyframe
for the scale. So now the icosphere will
collide with the building, and once it collides,
it will shrink down because we scale
it down to zero. This should look something
like the following. Oh wait, nothing is happening. Yeah, this is how our building will fall just like
the following. Which I think I like it. It looks good. Okay, everyone, this is it for how you can add a rigid body system to all
of your different pieces, how you start your simulation
by being deactivated and how to initiate the
destruction process using a collider object. In the next part,
we're going to make the simulation slightly
cooler by adding some constraints to
it and basically to add more variation to how
this building is falling. As usual, make sure
to save your file. In this part of the video, we're going to add
more variation to how this building is falling. This will be really simple. We're going to add a couple of constraints to all of
the different pieces, and this should
technically give us a slightly more pleasing result. Be generally when a
building is falling, there would be a lot
of chunks that stay connected because of the
metal bars and all of that. The goal of this part is to create something
similar to that. To do that, let's select all the different pieces by double clicking on the
pieces collection. Next, go to object, rigid body and choos
the option for connect. So it is important
to mention that since we have over
5,000 objects, it is important to wait
because these sort of processes tend to take
a lot of time in blender. So don't worry in
case your computer freezes for a second while
it is doing all the work. Okay, blender just finish
adding all the constraints, and please don't
click on anything because we still need
this menu in a second. So if I go to the front view by hitting
one from the number pad, you can see, and let me hide all the overlays.
Okay, I'll need those. All of these constraints
are weirdly distributed, as you can see, for
example, from the back. The main reason for that is that the connection pattern
is selected to active. So basically, Blender created all the constraints based on
the active selected object, and that's why they are weirdly distributed like the following. So we need to
change this option, the connection pattern from selected to active to
chain by distance. So change that. Blender will need to recalculate everything, so wait for now Blender just finished recalculating,
adding the constraints. And as you can see, right now, they are randomly distributed in an even way between all
the different objects. One important thing
is that all of them right now are here and they made the outliner Ms. That's why I just select
one of those constraints, hit Shift G to select similar, and from here, we can select all the objects that
does have the same type, which means all the
different constraints, hit M to move them to a new
collection, new collection, and let's call it
constraints and hit Create. And let me collapse
it. So all of my constraints will be living in this collection right now. I hit play, let's do this. Let's see how it will look. Et me just hide the overlays to see the result
in a better way. As you can see right now,
all the different pieces are kind of connected, and that's because of the
constraints right here. Already, you can see how the
foling process right now is slightly more realistic because some pieces are
connected to each other. But I think the connection
between them is too strong. That's why I want to
lower it a little bit, and that's what you can do
let me enable the overlays. Select one of those constraints. Let's select all the constraints by double clicking
on the collection. And if you go to the
physics stab from here, you will have an
option for breakable. This means that at
a certain point, we can break the constraint that is connecting the
different objects. We want to enable this option for all the different
constraints. So while you're holding Alt, click on this and this will make all the
constraints breakable. When will they be breakable? You have this threshold number. I tried looking for what
is the unit of this. It seems like it is
an arbitrary number that define when the
constraint will break. In my experience, I'm going to select all the
different constraints, select one of them to
be the active one, and let's jump to
the physics stab. Going to lower it to
something like five, click on this type five, and before you hit Enter, make sure to hit
Alt and hit Enter, and this will apply the value of five to all the
different constraints. So now, once we reach
this threshold value, the constraint will break. If you want to even add
more variations to it, let me go back to
frame number one and enable the X ray mode. Hit one, I'm going to disable
the pieces collection, so I will only be able
to see the constraints. Let's switch to the
circle select mode, and I'm going to
select a bunch of them randomly while
holding Shift. Let's say something like so. Let's go back to the
usual select box and select one of these
to be the active one. For these ones, I'm going to lower the threshold to three, while you're holding
Alt, click on Enter. All of these constraints
right here will have a value of three meanwhile, other ones will have
a value of five, which will add more
variations to our simulation. Let's enable the pieces
collection again, disable the X ray mode, and let's see how this will look like hit play again to
catch the simulation. Let's stop it here, disable all the overlays, go back to frame
number one, hit play. Mania, I'm digging this result. Okay, so this is it for
adding the constraints to add more variations to how
the building is falling, and now we can move
on to the next step, which is baking the simulation so we don't have to simulate
it every single time. But as usual,
before you do that, make sure to save your file. Baking is simply converting the simulation into keyframes. Why would you want to do that? First of all, because every
time we change something, blender needs to recalculate everything which
is time consuming. The other thing is
that now we need to create the simulation for
the rest of the objects. Trust me when I
say, if you try to simulate everything all at
once, Blender will crash. No doubt. That's why we're
working step by step, and that's why we need
to make the simulation. Of course, some of you might be worried about losing all of these informations
like the rigid body added to the pieces
or the constraints. But I want to remind you that
we're saving incrementally, so we can always
go back to one of the previous blender file and
restore our previous work. This is my usual workflow when it comes to baking up stuff. Instead of saving backups in
the project, for example, duplicating the constraints and putting it in the archive. Same thing for the pieces. I like to have different
blender files, so the blend file I'm working on is always light and optimized. So how can we bake our
simulation into keyframe? As usual, this is really simple. Let's select the entire
pieces collection by double clicking on it. You can't see the
selection because I need to enable the overlays. We selected everything. Next, go to object, rigid body, and from here, we should have the optict for bake
to key frames. And I think this option is
not highlighted because one of the objects must be in
active selection mode. So while you're holding shift, select randomly
one of the pieces. Then if you go to object, rigid body, you will have the option for bake
to key frames. Click on it. You will have the
start frame and end frame, which is basically
the range of baking. I'm going to leave it the
way it is and just hit Okay, and now as usual, let's wait for Blender
to bake the simulation. This will take a
little bit of time, so wait for it, and we'll
move on to the next step. Okay, so the simulation finished baking, and as
you can see right now, I have a lot of keyframes, and this was the
simulation we had earlier using rigid body that. Right now it is all
baked into keyframes, which is better because we won't lose our progress anymore. And now we're ready to
move on to the next step, which is to add a
particle system to add more details
to our simulation. If I just disable the
overlays for a second, this simulation still
needs a lot of details. We need small particles that
should be flying everywhere, and those will be
the small debris when the building is
collapsing. We don't have that. Right now, we only have
the big chunk we will create those small particles
using a particle system. But before actually we do that, since we don't need our
constraints anymore, you can double click
on this collection and and then delete it. Blender will crash. Okay, that was an
unfortunate turn of events. Blender crashed, so I had to rebake the entire
simulation into keyframes. And this time, I made
sure that I saved the file before deleting the constraints because
for whatever reason, that might cause
bleder to crash. And as I said, since we don't need this constraint
collection anymore, I'm going to select it
and delete high this way, we will have a slightly
lighter blender file. Make sure to save
your file as usual, and let's move on
to the next step where we will be adding
the particle system. Right now, we're going to
add a particle system to add some extra debris when
the building is falling. The particle system will be emitted from the faces
of the building. But since the building right now is fractured into
different pieces, adding the particle
system will be a mess. That's why we need to turn all of these pieces into one object. Some of you might think
that I'm going to select all the pieces and hit
Control G to join them, but that's a bad idea. Instead, and it's
actually the best way, we can use geometry
nodes for that. To do that, I'm just
going to disable the pieces collection
and then go Shift A. And actually, since we
don't need this collider, also, I can disable
this collection. Next, go Shift A, mesh,
and let's add a plane. We will have this plane in
the center of the scene. We don't care about scaling it, but what I need to
do is to change this editor to geometry
node editor, new. Let's call this building,
enable the magnets, so the nodes will
stick to the grid nicely and hit to
hide the sidebar. I'm going to delete
the group input because I don't need this plane. I'm going to create
my own geometry, which is the pieces collection, so just hit delete, take
the pieces collection and bring it here and
connect it to the geometry. And now you will
have your building. The really nice thing
about this setup is that we can always
move this plane, and since it does contain the geometry note tree that contained the piece good to go. The only thing that you
need to keep in mind that all of these right
now are instances, which means they are
not actual geometry. So now when we will add
the particle system, we will not be able to emit
particles from each piece. That's why you need to add another node called
realize instances. And you can think of
realized instances as just a way to
tell blender that, hey, blender, the instances turn them into actual geometry. So now when we will add
the particle system, we'll be able to
emit the debris or the fractured pieces or the particle system
from each piece. And yeah, this is the
setup we will use to merge all the different
pieces into one object. And you can actually
call this, for example, building Geo node or actually let's change it to pieces because I think that
makes more sense. And now we can create
our particle system. So jump to the particle
system tab from here, create a new particle system, and let's call it extra debris. Double click also on
this one, extra debris. Will be an emitter object. What will it emit?
That's really simple. You can disable the pieces
collection for a second, and let me enable the
pieces collection. Let's select randomly
some of those pieces, pieces from different areas while I'm hitting
Shift, of course. Then let's hit Shift D to
duplicate those pieces, right most button to
cancel any movement, M to move them to a new
collection, New collection, and let's call it particle
system debris and hit Create. And let's also disable the
pieces collection again. Select the particle system
debris by double clicking on the collection and hitting
G to resit the position. So everything right
now will be in the center and also disable it. Let's go back to our building
geodes particle system. And yeah, now we can start
building our particle system, and I think it
makes more sense to change this editor
to the timeline. And yeah, if I hit play, the building will start falling. So we need to ask ourselves at what moment we want to
start emitting the pieces. And I think somewhere around frame 20 or
let's say frame 18, that's a suitable point because the moment the building
starts falling, we want to start emitting the different particles
or the debris. And to be able to see that, let me go to render and from here instead
of render as halo, because we're not
seeing anything, let's change it to collection. And for the collection, it is
the porticle system debris. Also, let's hide the overlay. Let's go to the
emission settings. For the number,
let's say I want to emit 5,000 small pieces. Frame start. I want to start emitting those
particles at frame 18. And for the end frame, let's say I'm going to emit all of those different
small particles. For let's move forward. When does the building
kind of stops collapsing? Say at around frame 40, so end at 40 for the lifetime, which means for how long
you want those particles to be visible or to stay in the scene
before they disappear, each particle should stay until the end of the simulation. So make sure to bring
this number up to 250, and don't worry about the
frame range because blender, at the end of the
day will only render until frame 250, so
we're good to go. Lifetime randomness
that for the source, we want to emit them
from the faces, and probably you're wondering why we can't see anything yet. The main reason for
that if I jump to the modifiers tab,
as you can see, the particle system is
after the geometry nodes, and by default, the
particle system doesn't count in the modifiers.