Thursday 19 January 2012

Machine Trigger & Purpose Testing

I've been testing out the box of dog food being poured into a dog bowl. Initially I tried using Maya's classic particles to achieve this effect. I discovered that classic particles can't collide with each other, only with other objects which isn't suitable for this situation. Therefore I decided to try using nParticles which are able to self collide and was more satisfied with the results.

Maya nParticle Dog Food in Bowl Test from Mickey Bowen on Vimeo.



I wrote an expression which controls the maximum number of particles emitted:


////Resets the rate attribute to emit no particles when ever the
////the sim is played back from first frame in the playback range
if(`currentTime -q` == `playbackOptions -q -min`){

emitter1.rate = 0;

}else{


////When frame 55 or higher is reached, emit 20 particles per second
if(frame >= 55){

emitter1.rate = 20;

}

}

////After 20 particles have been emitted, stop emitting.
if(nParticleShape1.count == 20){

emitter1.rate = 0;

}

I found that when making the dog bowl inot a passive collider (for the particles to collide with), the particles would not collide with it. I have determined that the reason for this is because the bowl is a NURBS object. I then created a polygon sphere, deleted the faces making up its top half, reversed the normals so the collision would calculate correctly and put it on a display layer and switched off its visibility. This object was acted as the collider.

I also came up with the idea of having a cart with a sail on it being propelled forward by a desk fan to start off the machine. I tested this out by modelling a simple extruded cube, assigning a Lambert shader to it completely transparent, making it an active rigid body and parenting the cart geometry to it. It's propelled forward by an air field.

I also created a simple nCloth simulation to create the effect of the sail being blown by the fan. I used some component to component constraints to its vertices in order to connect the nCloth object to the mast of the sail.

Maya Fan Blade Rotation Expression and nCloth Test from Mickey Bowen on Vimeo.



To make the wheels rotate as the cart moves, I wrote the following expression:

wheel_front_right.rotateZ = cart.translateX / (2 * 3.1416 * 1) * 360;

To rotate the fan blade, I used the following expression:

fan_blade.rotateX = (time * fan_control.speed) * 10;

////fan_control is a NURBS circle with attribute I created called speed used
////to control the rotation speed of the fan.

The fan is activated using two keyframes animating the speed attribute to a higher value over time.

No comments:

Post a Comment