# Question about senoculars 3d engine

**URL:** <https://forum.kirupa.com/t/question-about-senoculars-3d-engine/104397>\
**Category:** Uncategorized\
**Created:** [March 15, 2004, 9:30pm UTC](https://forum.kirupa.com/t/question-about-senoculars-3d-engine/104397 "2004-03-15T21:30:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScHAmPi](https://avatars.discourse-cdn.com/v4/letter/s/4af34b/32.png) [@ScHAmPi](https://forum.kirupa.com/u/ScHAmPi)\
**Post date:** [March 15, 2004, 9:30pm UTC](https://forum.kirupa.com/t/question-about-senoculars-3d-engine/104397/1 "2004-03-15T21:30:36Z")

</div>

Hello, I’m trying to make a regular tetraeder in 3d with seoculars 3d engine. In this engine you have to use make3DPoint (x, y, z)

Now for this tetraeder I want to use a variable s that is the length of one rib. so this was the code I wrote with help from Voetsjoeba

[AS]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, scaleFactor) {  
var point = new Object();  
point.x = x;  
point.y = y;  
point.scaleFactor = scaleFactor;  
return point;  
};  
ConvertTo2D = function (pointIn3D, scale) {  
var pointIn2D = new Object();  
pointIn2D.x = pointIn3D.x_scale;  
pointIn2D.y = pointIn3D.y_scale;  
return pointIn2D;  
};  
RotatePointsAndConvert = 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, y, z, xy, xz, yx, yz, zx, zy, scaleFactor;  
var i = points.length;  
while (i–) {  
x = points\*.x;  
y = points\*.y;  
z = points\*.z;  
// rotation around x  
xy = cx_y-sx_z;  
xz = sx_y+cx_z;  
// rotation around y  
yz = cy_xz-sy_x;  
yx = sy_xz+cy_x;  
// rotation around z  
zx = cz_yx-sz_xy;  
zy = sz_yx+cz_xy;  
scaleFactor = focalLength/(focalLength+yz);  
x = zx_scaleFactor;  
y = zy_scaleFactor;  
z = yz;  
TransformedPointsArray\* = make2DPoint(x, y, scaleFactor);  
}  
return TransformedPointsArray;  
};  
var s = 200;  
cube3D = [make3DPoint(0, -2/3_Math.sqrt(s-1/2_s_1/2_s), 0), make3DPoint(-1/2_s, 1/3_Math.sqrt(s-1/2_s_1/2_s),1/2_s), make3DPoint(1/2_s, 1/3_Math.sqrt(s-1/2_s_1/2_s), 1/2_s), make3DPoint(0, 1/3_Math.sqrt(s-1/2_s_1/2_s), -1/2_s)];  
cubeRotation = {x:0, y:0, z:0};  
this.onEnterFrame = function() {  
this.createEmptyMovieClip(“cube”, 1);  
cube.lineStyle(0, 0x000000, 100);  
if (Key.isDown(Key.LEFT)) {  
cubeRotation.y += 0.05;  
}  
if (Key.isDown(Key.RIGHT)) {  
cubeRotation.y -= 0.05;  
}  
if (Key.isDown(Key.UP)) {  
cubeRotation.x += 0.05;  
}  
if (Key.isDown(Key.DOWN)) {  
cubeRotation.x -= 0.05;  
}  
cube2D = RotatePointsAndConvert(cube3D, cubeRotation);  
for (var i = 0; i\<cube3D.length; i++) {  
cube2D_.x += 350;  
cube2D\*.y += 250;  
}

```
cube.moveTo(cube2D[0].x, cube2D[0].y);
cube.beginFill(0x0000FF,20)
cube.lineTo(cube2D[1].x, cube2D[1].y);
cube.lineTo(cube2D[2].x, cube2D[2].y);
cube.lineTo(cube2D[0].x, cube2D[0].y);
cube.endFill()
//
cube.moveTo(cube2D[0].x,cube2D[0].y);
cube.lineTo(cube2D[3].x, cube2D[3].y);
cube.lineTo(cube2D[2].x, cube2D[2].y);
//
cube.lineTo(cube2D[3].x, cube2D[3].y)
cube.lineTo(cube2D[1].x, cube2D[1].y)

```

};  
[/AS] I dunno why but there seems to be a problem with it cu nothing appears when I push test movie, not even an error.

Anyone have an idea what the problem is?

O and I’m very very noobish at AS so plz don’t laugh at me when it’s something stupid 😃 😉

Greetz and thanks.

EDIT: O and don’t worry about the names that state cube cuz that’s only because I edited some code by Voetsjoeba.
