Skip to main content
Participating Frequently
February 23, 2009
Question

3D movement in AS 2.0

  • February 23, 2009
  • 2 replies
  • 213 views
I'm working on a project and I want to make a page that has 8 mcs in a circle. However, the circle is 3D. Some mcs are close, some are far. When a viewer clicks on an mc, the circle rotates. I've gotten ahold of some code and tried to implement it and it has not worked. Does anyone have any advice?

Something similar to the movement on this page:
http://www.templatehelp.com/preset/pr_preview.php?i=22810&pr_code=Q26Vn38V68vBY9CIBUNra62hZU0fNk
This topic has been closed for replies.

2 replies

March 7, 2009
oops, I'm a dummy

onClipEvent(load){
y=100;
speed=5;
radius=100;
xcenter=250;
ycenter=150;
zcenter=100;
angle=0;
fl=150;
}

onClipEvent(enterFrame){
z=Math.sin(angle*Math.PI/180)*radius+zcenter;
scale=fl/(fl+z);
y=Math.cos(angle*Math.PI/180)*radius;
_x=x*scale+xcenter;
_y=y*scale+ycenter;
_xscale= _yscale = scale*100;
angle+=speed;
//if(angle>359){
//angle-=360;
//}
}

there you go.
March 7, 2009
Try using this as a starting point. attach this code to a movieclip and watch it move, play with the numbers and there you go. Much of this code 'borrowed' from a bit-101.com tutorial. Thanks Keith!