Hey. I've been trying for a while to make a good 3D Flash engine and have been successful on the way. What I'm trying to do is make an engine that will draw a matrix of points that looks like this:
_|X|Y|Z|
0|#|#|#|
1|#|#|#|
2|#|#|#|
3|#|#|#|
4|#|#|#|
5|#|#|#|
And then the movie would use the drawing methods to make this shape.
What I'm trying to figure out is how I can get the X and Y rotations to affect the drawTo() X and Y coordinates without many bugs.
Here is a copy of my current script which will give you the front side of a star on your movie... you don't need to draw anything:
points = [[0, 0, 50], [0, -50, 0], [14.8, -20.2, 0], [47.5, -15.4, 0], [23.8, 7.7, 0], [29.4, 40.5, 0], [0, 25, 0], [-29.4, 40.5, 0], [-23.8, 7.7, 0], [-47.5, -15.4, 0], [-14.8, -20.2, 0], [0, 0, -50]];
shapes = [[0, 1, 2], [0, 2, 3], [0, 3, 4],[0, 4, 5], [0, 5, 6], [0, 6, 7], [0, 7, 8], [0, 8, 9], [0, 9, 10], [0, 10, 1]];
_root.createEmptyMovieClip("drawthis", -20);
drawthis._x = Stage.width/2;
drawthis._y = Stage.height/2;
this.onEnterFrame = function() {
drawthis.clear();
drawthis.lineStyle(1, 0x000000, 100);
drawthis.beginFill(0xFF0000, 100);
for (s=0; s<shapes.length; s++) {
drawthis.moveTo(points[shapes[s][0]][0], points[shapes[s][0]][1]);
for (p=1; p<shapes[s].length; p++) {
drawthis.lineTo(points[shapes[s][p]][0], points[shapes[s][p]][1]);
}
}
drawthis.endFill();
};
I was thinking that if a certain key was down I would have all the points in the POINTS array changed so that one number would have a chunk given to it from another number but that doesn't seem to be working very well.