Camera2D properties are not working (not following player, cant zoom, etc)

Godot Version

Question

Camera2D as seen in this photo

playerscene
My animation and movement are working just fine, but the Camera2D won’t follow the Player. Tried to do the empty scene and rebuilt the player to no avail. I also tried to zoom, but it’s still not working. Figured out that all Camera2D aren’t working.

  1. Is it because of the movement script? (I have isometric 4d movement)
    the script:

extends CharacterBody2D

@onready var animations = $AnimationPlayer

var is_rucksackopen = false

const speed = 100
const acceleration = 1000
const friction = 50
var moveStop = false

var input = Vector2.ZERO

func _physics_process(delta):
player_movement(delta)

if Input.is_action_just_pressed(“ui_rucksack”):
if is_rucksackopen:
rucksackclose()
else:
rucksackopen()

func cartesian_to_isometric(cartesian):
var screen_pos = Vector2()
screen_pos.x = cartesian.x - cartesian.y
screen_pos.y = (cartesian.x + cartesian.y) / 2
return screen_pos

func get_input():
input.x = int(Input.get_action_strength(“ui_right”)) - int(Input.get_action_strength(“ui_left”))
input.y = int(Input.get_action_strength(“ui_down”)) - int(Input.get_action_strength(“ui_up”))
return input.normalized()

func player_movement(delta):
input = get_input()

if input == Vector2.ZERO:
moveStop = true
velocity = Vector2.ZERO
play_idle_animation()
else:
moveStop = false
velocity = velocity.limit_length(speed)
velocity += cartesian_to_isometric(input * acceleration * delta)
play_movement_animation(input)

move_and_slide()

func play_movement_animation(input):
if input == Vector2(1, 0):
animations.play(“WalkSE”)
elif input == Vector2(0, 1):
animations.play(“WalkSW”)
elif input == Vector2(-1, 0):
animations.play(“WalkNW”)
elif input == Vector2(0, -1):
animations.play(“WalkNE”)

func play_idle_animation():
if moveStop == true:
if Vector2(1, 0):
animations.play(“IdleSE”)
elif Vector2(0, 1):
animations.play(“IdleSW”)
elif Vector2(-1, 0):
animations.play(“IdleNW”)
elif Vector2(0, -1):
animations.play(“IdleNE”)

  1. I did my research too but I can’t find the current properties. I tried with non-isometric 4d movement script but it’s working. Not sure why it’s not working with the isometric movement.
    This is the picture of run scene result. I put the object on the corner to see if the camera moves, but no… Also, I tried to put the object on other places too but still not working.

  2. No error comes.

  3. If it’s not something related to isometric movement, may I know the problem behind this and the solution please? Thank you for the help.

is the property “current” set to true on the camera?

there’s no “current” property in Camera2D

I apologize for not including my research further…
I searched for the “current” property but there’s no “current” property.
Tried to use Camera3D instead to achieve the “current”, turned it on, but it’s still not working :cry:

for camera2d its called “enabled”, sorry

Enabled is automatically on, and yes it’s still not working :smiling_face_with_tear: please help

So when you move your character the camera stays in place, allowing you to move the character across the screen?

yes exactly :cry:
i tried to do other properties too like zoom etc and all of them weren’t working.
i have another game with working camera2d (godot version 4.2.2), i built the player exactly like the player in the old version, but it’s still not working with the godot 4.3

do you have more then one camera in the scene?

no, there’s only one camera.

thank you for helping me… turned out nothing’s wrong with my settings or scripts. i solved the problem by rebuilding the game from scratch again… new file and such. not really the best solution but it’s okay…

this problem happened probably because my character2d is the child of a node2d and i made the camera2d as character2d’s child. it screwed all the camera and character. learnt the hard time. please dont make the mistake as i did :cry:

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.