Locking the camera on one axis (SOLVED)

I have a camera object following my character, but I only want the camera to move when the character is moving on the y axis. Is that possible?

In this case, it helps if the camera component is belongs to a separate camera game object:

local heropos = go.get_position("hero")
local camperapos = go.get_position("camera")
camperapos.y = hero.y
go.set_position(camerapos, "camera")
3 Likes

Thanks! I got it to work

3 Likes