Using Sandy 3D AS3, fill the viewport (exact fit) with multiple 3D objects.

Posted by Andrew Mullins on Stack Overflow See other posts from Stack Overflow or by Andrew Mullins
Published on 2010-05-19T17:58:20Z Indexed on 2010/05/19 18:00 UTC
Read the original article Hit count: 270

Filed under:
|
|

I'm stitching together an image using multiple instances of the sandy.primitive.Box. Each box is 96x91 while the viewport is 960x273 which should make for an exact fit if I layout the boxes in a perfect grid of 10x3. However, I can't seem to get the exact camera fieldOfView. I've tried a couple formulas (one for adjusting the "focal length" and one for adjusting the fov, directly). Both of these formulas produce a fov angle that is too narrow.

// focal length
(stage.stageHeight/2) / Math.tan(cam.fov / 2 * Math.PI / 180)

// field of view
2 * Math.atan2( (stage.stageHeight/2), -cam.z ) * (180 / Math.PI)

Another question about the same project: I need to adjust the perspective of each cube so that the image appears to be in 2D space (flat)... Any ideas on the best method for calculating such a "correction"?

© Stack Overflow or respective owner

Related posts about flash

Related posts about as3