Zooming in with camera

I have a sniper rifle with a scope and I use render-to-texture to display on the scope. I want that the scope zooms in. How can I realize it?

I would suggest altering the field-of-view of the camera that renders to the texture. (This is done in the camera’s lens-object, I believe.)

How can I done that?

Something like:

base.camLens.setFov(5)

Decreasing the number will zoom in more.

And how can I do this for only 1 camera?

Do you have multiple cameras with the same lens? If so, simply give each of them a different lens so that you can change only the one that you wish to change.

How can I done that?

cam.lens.setFov(5)

dont works.

It would be camera.node().getLens().setFov(5), assuming camera is the NodePath pointing to your camera.

1 Like

Ok, thanks. Thats what I want.