|
|
Search Tutorials
3d to 2dNow that the object rotation script is over, we need to convert it to 2d. This is relatively simple. Just a few lines. Copy the following lines of code to the action script window: function toScreen () {
for (i=0; i != Points; i++) {
vertex[i].dx = (vertex[i].x3*viewport)/(vertex[i].z3+600)+350;
vertex[i].dy = (vertex[i].y3*viewport)/(vertex[i].z3+600)+262.5;
}
}
Not much to explain here: A for loop similar to the previous one. Two formulae are applied to the vertices and then stored in two new variables. One thing to be noted, however, is that the constants at the end of the two formulae- 350 and 262.5 are actually half the values of the height and width values of the movieclip. If you are changing the size of the movieclip, you will have to change this values accordingly.
|
||||||||||||||||||||||||||||||||||||||||||||||||
![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||
|