3D spinning wheel
[ July 22, 2004 ] by Eric Lin
Intermediate 3D scripting for Flash part 4/5:
Learn how to build a 3D textured spinning wheel.

It is easy to make a 3d spin wheel with object on spots. We just create an array of (x,y,z);

A circle is 360 degree; If we want to make 3 biset points, then each point k will at the angle arc of k*360/(countOfSpots) to a startAngle; For example:

```angle0=0;

angle=Angle0+k*Math.PI/countOfSpots;

x=100;//arbituray number

y=Math.cos(angle);

z=Math.sin(angle);
```

When we need update the x,y,z on rotation, we just add an arc to startAngle. For example:Angle0+=(Math.PI/30); However, I need to extend the point (x,y,z) into 4 corners point in 3d format (x,y,z);

I add a small arc to angle to get point2, and up some height tp get anothte corner points; The height can be calculate by the distance between point1 and point 2; Use 3d equation to get _x,_y for 3D. Then skew the movieClip to 3 corner points.

Now:

```var pt1 = new Object();
pt1.y = 0;

var ptW = new Object();
ptW.y = 0;

var ptH = new Object();
ptH.x = pt1.x;
ptH.z = pt1.z;
ptH.y =50;

_root.skewObj(obj, 100, 100, _root.f3dPoint(pt1), _root.f3dPoint(ptH), _root.f3dPoint(ptW));
var depths = int(1000-pt1.z);
obj.swapDepths(depths);
```

 Name: Eric Lin Location: Taiwan Age: 46 Flash experience: Since Flash 5, about 4 years Job: neurosurgeon (a doctor who operates people's brain) Website: http://ericlin2.tripod.com/

 | Homepage | News | Games | Articles | Multiplayer Central | Reviews | Spotlight | Forums | Info | Links | Contact us | Advertise | Credits || www.smartfoxserver.com | www.gotoandplay.biz | www.openspace-engine.com | gotoAndPlay() v 3.0.0 -- (c)2003-2008 gotoAndPlay() Team -- P.IVA 03121770048