Tuesday 4 January 2011

Pinwheel island Pt.2

Now I finished the modeling one pinwheel and ready to texture it. But before I start to texture it, I wanted to do animate spinning the flags of pinwheel. I had a lecture about using expression in Alex's lesson. I really enjoyed the lecture because I used to study C++ programming and game programming in university in korea before I go to Ravensbourne. Also, over this summer holiday, I found MEL scripting and expression is familiar area to me and interesting. So I was going to try use simple expression for spinning the pinwheel. I think the best merit of using expression is i can control many objects by simple lines of programming language. Also it can be used very effectively on particles and dynamics.

So I played around few control lines to spinning pinwheel.




The expression lines in that picture is


Flags1.rotateZ = time*cos(time+100);
Flags2.rotateZ = time*cos(time+80);
Flags3.rotateZ = time*cos*time+70);


The Flags1 is the middle, 2 is left and 3 is right one. The middle one was the main pinwheel so I wanted to spin faster than other two.
The expression I wrote means : the flags' rotateZ value increases as the value of time multiplying by cos(time value+100 / 80 / 70).


Another try was


flags1.rotateZ = -time * 150 * sin(time*2);

flags2.rotateZ = flags3.rotateZ = -(time*100);


which means : flags1's rotateZ value increases by time and 150times faster and its spinning way is decided by sin(time*2) value.

As I used cos and sin function in the line, it was spinning left and right as the value of cos graph goes to + and -.


 



After Playing around with expression in many different ways,  I made it proper pinwheel island.  
I textured it as well. I wanted the pinwheel spins faster as time goes by. 

So the expression was

flags1.rotateZ = time*(time+100);

I multiplied (time+100) because it need to get faster. 



The result is :


 



The outcome is exactly what I wanted. I really liked using expression, reminding old days and I have been thinking studying MEL scripting and expressions really seriously. As soon as this project finishes, I will start up studying MEL and expressions!

No comments:

Post a Comment