i have a simple leaning in the game and when i lean right and move forward at the same time the camera starts glitching out. this only happens on the right lean. this is the code i use for leaning.
if Input.is_action_pressed("lean_left") and !lean_left_ray.is_colliding() and !lean_left_ray_2.is_colliding() and !lean_left_ray_3.is_colliding():
lean_left_collision.disabled = false
lean_right_collision_2.disabled = true
head.position.x = lerp(head.position.x,-0.50, delta * lerp_speed)
head.rotation.z = lerp(head.position.z,0.35, delta * lerp_speed)
head.position.y = lerp(head.position.y,0.50, delta * lerp_speed)
leaning = true
else:
head.position.x = lerp(head.position.x,0.0, delta * lerp_speed)
head.rotation.z = lerp(head.position.z,0.0, delta * lerp_speed)
lean_left_collision.disabled = true
lean_right_collision_2.disabled = true
leaning = false
# leaning right
if Input.is_action_pressed("lean_right") and !lean_right_ray.is_colliding() and !lean_right_ray_2.is_colliding() and !lean_right_ray_3.is_colliding():
lean_left_collision.disabled = true
lean_right_collision_2.disabled = false
head.position.x = lerp(head.position.x,0.50, delta * lerp_speed)
head.rotation.z = lerp(head.position.z,-0.35, delta * lerp_speed)
head.position.y = lerp(head.position.y,0.50, delta * lerp_speed)
leaning = true
else:
head.position.x = lerp(head.position.x,0.0, delta * lerp_speed)
lean_left_collision.disabled = true
lean_right_collision_2.disabled = true
leaning = false
i couldnt think of anything to solve this problem as im still quiet new to coding i have no idea what could cause this.