how to make the 3d camera follow the player only in the z axis

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By furtree

I don’t want the camera to follow the player from other axes, for example when the player is jumping I want the camera to stay in its position

:bust_in_silhouette: Reply From: kidscancode

Put a script on the camera:

extends Camera

export (NodePath) var player  # assign the player node here

func _process(delta):
    camera.transform.origin.z = get_node(player).transform.origin.z