1

I already asked this question over there: https://github.com/mrdoob/three.js/issues/2070#issuecomment-6372113 But I did not really get it right now.

Here is my problem again: i am using this function to calculate the screen position (x,y) of my Vector3.

    this.toScreenXY = function(position, camera, canvas)
    {
        var pos3D = position.clone();
        var pos2D = projector.projectVector( pos3D, camera );

        return {
            x : ((pos2D.x + 1) * canvas.domElement.width / 2 + canvas.domElement.offsetLeft),
            y : ((-pos2D.y + 1) * canvas.domElement.height / 2 + canvas.domElement.offsetTop)
        };
    };

But when I got the correct screen position, turn the camera by 180 degree (about the y-axis), I got the same x,y values even if the real Vector3 is behind the Cameras view. Any idea how to check wether the Vector3 is in Cameras view or not? Thank you for your help!

chsymann
  • 1,640
  • 1
  • 15
  • 15
  • 2
    Your question can be restated: "How to check if a point is inside the camera's frustum." This is a separate issue from your projection methodology. See [this](https://github.com/mrdoob/three.js/issues/1209) and [this](http://stackoverflow.com/questions/10858599/how-to-determine-if-plane-is-in-three-js-camera-frustum). – WestLangley Jul 20 '12 at 02:50

0 Answers0