Plus does anyone know how to make each face of the square in to a link other scenes
Code:
this.createEmptyMovieClip("theScene", 1);
theScene._x = 275;
theScene._y = 175;
focalLength = 300;
make3DPoint = function (x, y, z)
{
var point = new Object();
point.x = x;
point.y = y;
point.z = z;
return point;
}
;
make2DPoint = function (x, y)
{
var point = new Object();
point.x = x;
point.y = y;
return point;
}
;
isVisibleBetween = function (a, b, c)
{
if ((b.y - a.y) / (b.x - a.x) < (c.y - a.y) / (c.x - a.x) ^ a.x < b.x == a.x > c.x)
{
return true;
return;
}
return false;
}
;
drawFilledSquare = function (a, b, c, d)
{
this.clear();
this.lineStyle(2, 0, 100);
if (isVisibleBetween(a, b, c))
{
this.moveTo(a.x, a.y);
this.beginFill(this.col, 100);
this.lineTo(b.x, b.y);
this.lineTo(c.x, c.y);
this.lineTo(d.x, d.y);
this.lineTo(a.x, a.y);
this.endFill();
}
}
;
Transform3DPointsTo2DPoints = function (points, axisRotations)
{
var TransformedPointsArray = [];
var sx = Math.sin(axisRotations.x);
var cx = Math.cos(axisRotations.x);
var sy = Math.sin(axisRotations.y);
var cy = Math.cos(axisRotations.y);
var sz = Math.sin(axisRotations.z);
var cz = Math.cos(axisRotations.z);
var x;
var y;
var z;
var xy;
var xz;
var yx;
var yz;
var zx;
var zy;
var scaleRatio;
var i = points.length;
while (i--)
{
x = points[i].x;
y = points[i].y;
z = points[i].z;
xy = cx * y - sx * z;
xz = sx * y + cx * z;
yz = cy * xz - sy * x;
yx = sy * xz + cy * x;
zx = cz * yx - sz * xy;
zy = sz * yx + cz * xy;
scaleRatio = focalLength / (focalLength + yz);
x = zx * scaleRatio;
y = zy * scaleRatio;
TransformedPointsArray[i] = make2DPoint(x, y);
}