Z value in unproject method

Hello,
I was looking into Z in unproject method. I ran into this thread

It claims that “If you set the z value to 1, you will hit the first invisible plane in front of your camera, so basically your 3d z position will be the minZ value of the camera. By lowering the z value of the mouse click you can hit planes located farther away.”

This thread is pretty old, and I do not think it is still true. In the playground below, a sphere appears much larger when it is placed at the position that corresponds to (mouseX, mouseY, 0) than when it is placed at the position that corresponds to (mouseX, mouseY,1)
(toggle between 18 & 21 lines)

Can someone confirm that Z component of the 1st argument of unproject should be 0 (not 1) to produce a point on the closest plane in front of the camera?

Thank you,
David

I would say yes :slight_smile: 0 will be near plane and 1 far plane which you can adapt through your camera minZ and maxZ property

1 Like