2
$\begingroup$

Is it possible to change camera's focal length within the game?

What im looking for is that "Bow zoom in" Or "warping".

$\endgroup$
3
$\begingroup$

These two lines are all you need to change the active camera's focal length.

cam = bge.logic.getCurrentScene().active_camera
cam.lens = 90.0 #or whatever value you want

bge.logic.getCurrentScene().active_camera gets the active camera in the current scene.
Then cam.lens is accessing the lens attribute of the camera defined in line one.

Read through the docs about the game camera, and you will see other properties you can get or set.

Do note that because field of view and focal length are related you can not set both lens and fov at once. Which ever value you set last will be the value that is used, and the other will be calculated for it.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.