A little this way
If you find that any of the following has something common with the 'Advanced Math' Professor from the College you studied in, it is purely incidental.
But actually, it has something that you might remember studying in High School. It's actually the trignometrical formulae you will use to rotate the vertices "virtually" and then project it on to the screen.
Now we have to workout the logic; You might say that "but we did that a long time ago!", but then, you read the note above: It's just as confusing as Advanced Math. You just can't understand it by reading it. So, let's go.
First, let's note that, we can rotate only one axis at a time. So, we need 3 sets of 3 variables for each vertex to rotate it along all the axes. We will then apply the formula, to rotate it on the x axis. We will store the rotated values in a new set of 3 variables. We will then apply the formula to rotate it on the y axis on the newly created set of 3 variables. We will then store the result in the next set of 3 variables. We will repeat it for the z axis rotation.
Now read the above paragraph again and again until you get it right.
Now, an important point: Although you can use the formula to rotate the object using just degree measure, Flash can calculate sine and cos values only with radian measure. So, you need to convert the degree to radian before you can use the sine and cos functions.
After rotating the object, we need to apply some formula to convert the x,y,z co-ordinates to just x,y co-ordinates, that is, convert the 3d address to a 2d address. That too will be done induvidually for each axes using formulae and the result is stored in two new variables.
After converting the object to 2d, we will have to draw the lines and vertices. We will use a for loop for doing this. We will adjust the _x,_y,_xscale,_yscale and _alpha properties of each movieclip to do this.
We will use three methods, each one for rotating, projecting and rendering the object.
We will do this in the following pages.
|» Level Advanced|
Rating: 8.99 Votes: 1238
|Age: 14 Profession: High School Student Location: Chennai, India(Not Indiana). Just doing it for fun. Ready to do small Freelance jobs.|
|Download the files used in this tutorial.|
|Download (51 kb)|
|More help? Search our boards for quick answers!|