How to get Pixel Precision in PV3D

Surfing the web I found an interesting post in Everyday Flash , it explains how to get Pixel Precision in PV3D ( Getting a textured object show his texture with a 1:1 aspect relation )

To position the object we use this formula:

1
3dobj.z = (camera.zoom * camera.focus) - Math.abs(camera.z)

And to get x,y 2D coordinates of the 3D object this one:

1
2
screenPosX = 3dobj.screen.x + viewport.viewportWidth / 2;
screenPosY = 3dobj.screen.y + viewport.viewportHeight / 2;
Comment are closed.