I've been trying to make the camera only follow the Y axis of my character and I do not know how to solve this.
How do I freeze the X and the Z on my camera?
Not sure about your setup, maybe that way:
camera.global_position.y = player.global_position.y
2 months later
trizZzle I ended up solving this problem after extreme emotional turmoil and nearly breaking up with my fiance over the stress
xtends Camera3D
var initial_position = Vector3.ZERO # Store the initial position of the camera
func _ready():
Store the initial position of the camera
initial_position = global_transform.origin
func _process(delta):
Get current camera position
var camera_pos = global_transform.origin
# Freeze X and Z positions relative to initial position
camera_pos.x = initial_position.x # Set X position to initial X position
camera_pos.z = initial_position.z # Set Z position to initial Z position
# Update camera position
global_transform.origin = camera_pos
You can also alter this stuff in order to freeze the axis directions as you please