Distance from Camera to Object - samplerInfo.pointCamera.pointCameraZ?

Hey there!

Currently I am trying to feed the distance between the camera and the object, into a clamp or setRange node, to drive the opacity of my object. I’m using a samplerInfo node with the pointCameraZ attribute, but the issue is that pointCameraZ seems to always equal 0.
I thought pointCameraZ would give me the length of the ray cast from the camera and I could set a min and max value to that to be input into my opacity.

Does anyone know a solution to this? I’ve looked around, and people have said to use the pointCameraZ plugged into the setRange node, and I’ve tried that. Perhaps I did something wrong?

https://forums.creativecow.net/docs/forums/post.php?forumid=61&postid=857907&univpostid=857907&pview=t

Found the solution to this. The data you get from pointCameraZ is in negative values :slight_smile: Easy to fix that.