I want to make my camera tilt when wall running but cant figure it out

Godot Version



As I said, trying to make the camera tilt when wall running, here’s what I got so far

if not is_on_floor():
if is_on_wall():
if Input.is_action_pressed(“Forward”):
velocity.y = jump_gravity * delta
$Neck.rotation_degrees.z = lerp(camera.rotation_degrees.z, 45, 2*delta)

its the final line the doesn’t work, the entire thing just crashes, if someone could create an entire new line to solve it I would be greatly in your debt, I started coding this all for the first time about 4 days ago and am still figuring out how to code, thanks for any and all help possible.

lerp does not operate over time. 2 * delta at 60 FPS would be about 0.0333, lerp would return 0.0333 of 45, so you might see 1.5 degrees tilt.

This might have worked if camera rotation was on both sides of the equals sign.

camera.rotation_degrees.z = lerp(camera.rotation_degrees.z, 45, 2*delta)

This would slowly add up, but never reach 45 degrees.

Preferably you would use a tween.

var tween := $Neck.create_tween()
tween.tween_property($Neck, "rotation_degrees:z", 45, 2).from(0).set_Trans(Tween.TRANS_QUAD)

I put this in and am now getting the error

Line 42:Cannot find property “tween_property” on base “Callable”.
Line 42:Function “tween_property()” not found in base Callable.

I forgot the parenthesis, create_tween() is a function