P. 1
Blender Art Magazine #16

Blender Art Magazine #16

4.0

|Views: 213|Likes:
Published by mefjak

More info:

Published by: mefjak on May 20, 2009
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as PDF, TXT or read online from Scribd
See more
See less

09/30/2013

pdf

text

original

Prior to running the main script, I've saved all object's rest
positions into good old Game-Engine properties using this one
time usescript. It also saves a starting time offset value for
each object. The example I'm sharing here was used for the
roof; it sets the start time according to a distance from center
formula as you can see in line 38 and that's why the roof's
tiles start falling into position from the outer part to the cent-
er. I'm also using a little bit of random generators here.

So this script uses lots of random numbers and different for-
mulas and we still need to control the final or rest position of
every object so that the whole bunch correctly builds the ga-
zebo; this is when the predictable formulas and pseudo-ran-
dom generators save the day.

The trick is to predict were the object is gonna be at the end
of the movement and to offset the entire motion accordingly
so that when it actually reaches the rest position you have it
right were you wanted it. In lines 96-98 and 113-115 I'm calling
the location and rotation formulas but I'm feeding them the

time value of 100 which marks the end of the movement (like
seeing into the future!) Then in lines 130-135 I simply subtract
this value to the results of the real time formulas and I have
all objects magically landing right in the center of the world.
Finally I add the location values previously saved in each ob-
ject with the secondary script and now they land in the de-
sired position!

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->