Godot Version
Godot 4.5.1 stable
Question
I would like to ask for help again. I want to use a scope for a sniper rifle. I am trying the subview camera approach. I have already managed to activate the scope when “AIM” and I can move it. However, no matter how hard I try, I cannot get the camera to zoom or adjust anything. I also tried using tween but that didn’t work either.
Does anyone have any tips on what is evading my attention? I would like to add an extra zoom in addition to the basic zoom.
Thank you in advance for your answers.
What do you mean by “can’t”. Can you manipulate the viewport camera node from the script?
Based on the “approaches” I found, yes.
So where’s the problem then? Use a tween to animate position and/or fov of that camera - and there’s your zoom.
Unfortunately, the animation interrupts the entire aim process, which is why I don’t use this animation for aim.
I’m currently at the point where it sets the correct aim position for each weapon and handles the sniper separately. However, if I try to zoom with the sniper, it immediately jumps back to its starting position. I’ve been struggling with this for 2 days now and I can’t figure out why the zooming won’t stay.
I must be making some minor logical error that I’m just missing.
I managed to solve it!
The problem was that I forgot to turn off the automatic camera update in the character script. This handled the camera zooming when running and aiming. Since a value was given for each, when the aim was active it took the value given to the camera and since the AIM was also active when zooming, the two values interfered with each other.
1 Like