| Creating a spaceship fleet using particle instance |
|
| Written by Dzordz | |||||
| Sunday, 22 April 2007 | |||||
Page 2 of 3 Select instancer and in attribute editor uncheck auto load selected attributes. Now you can select anything without loosing data in attribute editor.
Create another ship, but make it bigger, he is the boss. Add it to instancer using add selection button. When you do that, nothing will change. That’s because by default all instances use first object.
So in particle shape node scroll down to Per Particle (array) attributes. Hit general button.
Name attribute ID. This attribute will control which object is used for instancing on which particle. So make it float, and check Per Particle (array) since it’s going to apply to every particle separately.
Then select all particles and in component editor change id on the last particle to 1. Still nothing will change. That’s because ID attribute is not linked to instancer.
In particle shape node, under the instancer (geometry replacement) tab change object index to ID. This will link object index to ID. Now you have the boss.
While particle1 is selected go to fields menu select uniform field. This field will apply constant movement at every frame of animation. Set magnitude to 10, attenuation to 0, and direction to move your ships.
Now they will move. It’s time to add some turbulence to their movement. We are not going to use turbulence field. Instead we will write simple expression. Go to Per Particle tab, and in popup menu choose runtime after dynamics. This will apply expression after the dynamic part (forces).
Write particleShape1.position+=rand(-0.025, 0,025); This will move particles random by 0.025 in positive or negative direction. If you look carefully, you will notice that particle is moving in all three axes by same number. If you want particle to move in three axes separately type this: particleShape1.position+=<<rand(-0.025, 0.025), rand(-0.025, 0.025), rand(-0.025, 0.025)>>
Now create one volume axis field, set around axis to 0, shape to cylinder, and set magnitude to 20.
When ships pass through the field, they spin, around the center of the field, but their rotations stay. That’s because the particles doesn’t have rotation since they are just a points in the space.
To fix this go to instancer tab and change AimDirection to velocity. This will rotate instanced objects to the movement direction of particles. In frame 0, you will get funky rotations. This happens because velocity at frame 0 is 0. To fix that set initial state to some frame where particles move (frame 2 will do fine)
If your objects rotate in wrong direction you can solve that by rotating pivot of the object. You can do that by selecting object, hit f8, and click on cross icon. This will display rotation handle. You can rotate it by 90 degrees by going to options for rotate tool. There’s check box snap rotate. If you check it, you can enter 90, to snap to that angle. Then rotate your handle. The other way is to select all vertices of the object and in rotate options choose component use object pivot. In this way you will rotate vertices, but rotation axes will remain in place. Picture below
Now model some simple terrain. Make obstacle for some of the ships.
|
|||||
| < Prev | Next > |
|---|














