Translation

2.8.10

Destructing the wall using rigid bodies and particles


Image



Image


First, create nurbs or poly plane and make it looks like simple terrain, nothing fancy… Also create some lights.


Image


Then create wall using cube with some decent number of divisions. Texture it if you want.
Duplicate it. Why? One will be original wall, and the second will be the one we are going to destroy. First will appear in animation before explosion and second will appear during explosion.


Image


Hide first wall (you can put it in layer). Create another cube. This cube will be used to create area of shattering.


Image


Deform it. I used this in tower tutorial. Duplicate it.


Image

Despite having the best image hosting, a site may not be that ideal for search engine marketing. Basically we need theweb hosting services to be adaptable, with free online backup. Strategies related to affiliate marketing or adsense marketing can be decided later. A cheap web hosting may not be able to offer this much.
Duplicate the second wall. Now you have 3 copies of the same wall. Second will be wall after explosion, and third will be part of the wall that will fly around.
So now select second wall and cube and do mesh/Booleans/difference


Image


Then select third wall and the second cube and do mesh/Booleans/intersection
Note, before using Booleans delete history on objects.


Image


Then select the second wall (wall with hole) and go to dynamics menu set, delete its history and apply default lambert1 material to it. Go to effects/create shatter option box. In tabs select solid shatter and for post operation select shapes. Change the count to desired number of pieces.


Image


After few seconds of calculation you shall get pieces.


Image


Now select terrain and go soft/rigid bodies/create passive rigid body. Passive rigid body is object that is interacting with other rigid bodies, but it’s not affected by any force. Two passive rigid bodies doesn’t interact, passive rigid bodies interact only with active rigid bodies.


Image


Then select shards and go soft/rigid bodies/create active rigid body. Active rigid body is affected by forces, and it is interacting with active and passive rigid bodies.


Image


Select all shards and in the channel box click in inputs click rigidbodyXX, list of attributes shall appear. Scroll down and turn the collisions off. If you don’t do this shards will penetrate each other, because distance between them is 0. All dynamics operate with offset which is by default 0,1.
Also you can change the mass of the bodies. I did this according to size of the objects.


Image


Select the second wall and make it passive rigid body.


Image


Now unhide the first wall. I wanted explosion to start at frame 25. That means that wall will be normal first 24 frames. So at frame 24, in the channel box set visibility to 1 (on) then right click on visibility and in the popup menu click key selected. In frame 25 set it to 0 (off) and key it. For second wall and shards do the opposite.


Image
 Select shards and go to fields/radial. Radial field creates force from one point to all directions.  Move it, and key magnitude for 5 frames since it’s only going to add impulse to shards. So at frame 24 magnitude is 0, at 25 was 300 and at 30 it was 0.


Image



Image


Select shards and go to fields/gravity. Key magnitude at frame 24 to be 0, and in 25 set it to 9.8 (or any value you need).


Image



Image


Also in playback settings (last icon in the range slider) set playback rate to play every frame. All dynamics need this.


Image


Also you can create turbulence field to give shards a bit of randomness. Key it like you did with radial field.


Image


In my case it went really high, but lasted very short.


Image


When the shards fly away one from another and from the wall key their collisions attribute to be on.


Image


Sometimes you might need to key them one by one, because there might be some parts that are close to the ground, and others that are still close one to another.


Image


So, I got nice collision with ground.


Image


I tweaked mass further.


Image



Image


You can create camera to get nice shot. It’s cool when shards get close to camera.


Image


Then create one polygon (create polygon tool). This polygon will be used to emit small pieces of wall. This object will be hidden. You can hide it later or just turn it’s primary visibility.


Image


Select that polygon and go to particles/emit from object. This will create omni particle emitter, and particle system.


Image
Change emitter type to surface, set the speed to 0, min distance to 0, and max distance to .2 or something like that. This will offset particles from that plane.
Key the rate attribute. In my case it was 0 at frame 24, 3000 at frame 25 and 0 at frame 26. Rate is the number of particles emitted in one second (24 frames). So real number of particles emitted here is 3000/24.


Image


Select particle1, and in attribute editor scroll down to per particle attributes. Right click on mass, menu shall pop up. Choosecreation expression.


Image


Expression editor will appear. Check creation. This means that expression will be applied only when the particle is born. TypeparticleShape1.mass=rand(1,30);

Rand is command that gives random number between the two argument numbers. In this case particle mass will be some number from 1 to 30.


Image


Go to window/relationship editors/dynamic relationships. Find particle1. Select all three fields on the right. This means that all three fields will affect particles.


Image


If you play, you shall get something like this.


Image


Now it’s time to shape our particles. Create poly cube and make 4 or more stones.


Image


Then select all 4 stones and particle1 and go to particles/instancer option box.
Remove particle1 from list and set cycle to none.


Image


If you play, lot of stones will fly. All of them have same orientation and size, and they are all the same.


Image


So scroll down to per particle attributes and click general. Then select particle tab. Scroll down to userScalar1PP. This will create new attribute it the list. We will use this attribute to change the id of particles, so they will use all four stones.


Image


Then right click userScalar1pp in per particle list and choose creation expression (like you did with the mass). In expression editor type particleShape1.userScalarPP=rand(0,3);
If you look at instancer1 node you will se that there are four objects with id’s 0,1,2,3. So rand is choosing randomly between these id’s for every particle when it’s born.


Image


Then scroll up to instancer tab and change object index to userScalar1pp.


Image


Then add another attribute but this time it will be userVector1PP.
Also go to creation expression like you did with mass and userScalar1pp.

Now userVector1pp will be used to determine size of particles. That size shall be proportional to mass. So I created variable $m which generates random mass, and for size I just divided it by 100.

Vector $m=rand(50,200);
particleShape1.mass=$m;
particleShape1.userVector1PP=$m/100;
particleShape1.userScalar1PP=rand(0,3);

Now every particle has random mass and size. Note, on the picture there’s not user scalar1PP because I forgot to add it earlier.


Image


So change scale to userVector1PP


Image


Create another attribute userVector2PP and create creation expression like this:

particleShape1.userVector2PP=rand(0,360);

Scroll up to instancer tab and set rotation to userVector2PP
This means that every particle shall get random rotation at start.


Image


Now if you play, it’s looking better. The only thing left is to give spin to particles.


Image


So, create runtime before dynamics expression (in the same menu where is creation expression). Type:
particleShape1.userVector2PP+=<<15,15,15>>;

+= means that values are adding at every frame (same as particleShape1.userVector2PP= particleShape1.userVector2PP +<<15,15,15>>)

so our particles are rotating 15 degrees per frame in all axes. This is not the best way I just wanted to give simple example. It’s on you to explore.



Image


Select particles, and select ground and go to particles/make collide. Set resilience to .7;



Image
That’s it. At this point you can add explosion, and smoke…


0 comments:

Post a Comment