Inverse Of Camera.lookat()
I googled far and wide but I haven't found the solution to what I think to actually be a pretty common situation. Say I have a THREE.PerspectiveCamera initialized to look at a cert
Solution 1:
If your only usecase is "I want to be able to access the camera-targets position via the camera object", you could just put a reference into the camera object.
var camera = new THREE.PerspectiveCamera(45, 2, 0.1, 100);
var target = new THREE.Vector3(1, 2, 3);
camera.lookAt(target);
camera.targetRef = target;
//access itvar iNeedThisNow = camera.targetRef;
Solution 2:
I figured it out and wrote my solution here. Since the issue affects both THREE.TrackballControls
and THREE.OrbitControls
, the solution involves applying a slight change to both those files. I wonder if it can be considered a valid change and make its way to rev. 70; I will issue a PR on github just for the sake of it :)
Thanks to all those who pitched in.
Post a Comment for "Inverse Of Camera.lookat()"