auduno / headtrackr

Javascript library for headtracking via webcam and WebRTC/getUserMedia
3.69k stars 503 forks source link

Suggestion: add setOffAxisProjection method to THREE.PerspectiveCamera #34

Open DBraun opened 10 years ago

DBraun commented 10 years ago

I imagine THREE.PerspectiveCamera could have a function like setOffAxisProjection(x, y, z, screenWidthPixels, screenHeightPixels)

x, y, and z refer to the viewer's position in centimeters relative to the center of the screen

From controllers.js it looks like all you need are wh, and ww. These are pixel measurements, right? That's my guess based off THREE.PerspectiveCamera.setViewOffset

The code that currently refers to fixedPosition could just inspect camera.position. If this seems like a bad idea, then fixedPosition could also be passed as an argument to setOffAxisProjection.

For a related issue, please take a look at this StackOverflow question.