Viewmodel camera FOV displaces barrel position

Looked thru the camera3d docs and found some methods that seemed they would work. After a few tries i got it to work.

barrel_pos → node3d to keep track of where i wanted the barrel to be in space (from player camera pov)
z → screen position of the barrel from viewmodel_cam pov

Then i just set the barrel’s global_position to a projected position from player’s camera pov, using the screen position i wanted, and the distance of the barrel from the player’s camera