1 Attachment(s)
3B box trigonometry question ... experts?
Hey
I just checked out an excellent 3D tut here
http://www.codylindley.com/Tutorials/trigonometry/
I'm trying to point out the 8 x and y postitions in a box ...
Perspective depth is not important in my case.
I do need to incorporate a viewing angle (see attached trig.gif)
any help out there?
Kind Regards
Poden
******** AS *********
Code:
// you'll need to make a linked clip named 'dot'
function attBox(){
var distance = 200; // perspective
var width = 150; // box width
var height= 200; // box height
var depth = 50; // box depth
// it takes 8 (x,y,x points) to make a box
arrX = [width,width,width,width,0,0,0,0] // xpos
arrY = [height,height,0,0,height,height,0,0] // ypos
arrZ = [depth,0,depth,0,depth,0,depth,0] // zpos
for(var i=0;i<arrX.length;i++){ // loop
_root.attachMovie("dot",["dot"+i],i) // attaching mc 'dot'
_mc = _root["dot"+i] // variable mc name
var x = arrX[i];
var y = arrY[i];
var z = arrZ[i];
var perspective_ratio = distance/(distance+z)
var perspective_x = x * perspective_ratio;
var perspective_y = y * perspective_ratio;
_mc._x = perspective_x;
_mc._y = perspective_y;
}
}
attBox()
******** AS *********
http://test.nozebra.dk/trig/trig.gif