Help my camera is freaking out!

Are you sure your raycast is successfully detecting the floor? According to your error messages, both basis.x and basis.y are zero vectors, which indicates align_with_floor() got called with a zero vector.

How would I know it is successfully detecting the floor? I am very much new to the software and last coded (on this project) a long while back

I also just clicked the error, and it brought me to line 36 in my player script

I also saw when checking that my position for the ray cast is at 0.103, when I changed it to 0 the issue still continued

You can use RayCast3D.is_colliding():

	if is_on_floor():
		print($RayCast3D.is_colliding())

Try if this consistantly prints true, false, or both. Though it looks like the raycast is too short. (Which might have been the reason for the adjusted position?)

it isnt

Try making it longer then, or lower its position.y. The raycast should be partially visible outside of the player’s mesh.

Desktop 2026.03.16 - 20.05.06.01

I tried lowering it and seemed like nothing really changed, also when I am moving the ray cast there is no clear way to see the ray cast in which I’m moving?

It also still says false, is there something I was missing?

So it seems I may, I fixed the game, so it seemed that when I was following the tutorial it wanted me to use ‘Collision layers’ (or smth idk), as it turns out Ray Cast was only using collision mask 1 (player) and not my ground (which was 2), the reason the guy in the tutorial never had issue was because he never had used the camera I had implemented

so far this is working fine and now are having no issues, thank you @gertkeno and @hyvernox for trying to help me sort out this weird camera!

1 Like