How do you test to see if the camera/player is looking upwards (say between 70 and 110 degrees)?

how do you test to see if the camera/player is looking upwards (say between 70 and 110 degrees)?

Usually it’s done by measuring dot product between forward vector and Y axis. Something like:

pc.Vec3.dot (this.entity.forward, pc.Vec3.UP) < 0.2

oooo that looks cool. i will give it a go. thank you.

For those looking for a code example , here is mine

            var cameradir = this.camera.forward.clone();
            var lookingup = false;
            if (cameradir.dot(pc.Vec3.UP)>0.9) {
                lookingup = true;
            } 
1 Like