0

In Three.js, I want that the top of the render area (first row) point to y=0 in the world

Also, the camera need to look straight (lookAt)

This is my values:

camera = PerspectiveCamera
camera.position.z = 1895.8448868133867
camera.fov = 20
screen.width = 1280
screen.height = 689
camera.lookAt( new THREE.Vector3(0,this.camera.position.y,0) )

I know the result is -264 (camera.position.y) but I don't know how to get there...

Thank you for any help! :-)

itzikpel
  • 165
  • 3
  • 17
  • The solution is not unique. See http://stackoverflow.com/questions/13350875/three-js-width-of-view/13351534#13351534 for the formulas. – WestLangley Nov 16 '13 at 01:31
  • Thanks, but I can not seem to get what I want with these formulas. Maybe I do not know how exactly am I supposed to use them to get what I need – itzikpel Nov 16 '13 at 11:47

1 Answers1

0

I figured it out.

var vFOV = camera.fov * Math.PI / 180;
var height = 2 * Math.tan( vFOV / 2 ) * dist;

camera.position.y = (height/2) * -1
WestLangley
  • 102,557
  • 10
  • 276
  • 276
itzikpel
  • 165
  • 3
  • 17