Skip to content

Commit caf1caa

Browse files
Fix rotation to move on fps character
1 parent 5c1354a commit caf1caa

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

fps/bob/head_bob.gd

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,9 @@ func head_bob_process(horizontal_velocity:Vector3, input_axis:Vector2, is_sprint
9696
if is_sprint:
9797
input_axis *= 2
9898
if rotation_to_move:
99-
new_rotation += _head_bob_rotation(input_axis.y, input_axis.x, _delta)
99+
new_rotation = _head_bob_rotation(input_axis.y, input_axis.x, _delta)
100100

101-
head.position = new_position
101+
head.position = original_position
102102
head.quaternion = new_rotation
103103

104104

@@ -115,9 +115,8 @@ func reset_cycles():
115115

116116

117117
func _head_bob_rotation(x, z, _delta) -> Quaternion:
118-
var target_rotation : Quaternion
119-
target_rotation.from_euler(Vector3(x * angle_limit_for_rotation, 0.0, -z * angle_limit_for_rotation))
120-
return lerp(head.quaternion, target_rotation, speed_rotation * _delta)
118+
var target_rotation := Quaternion.from_euler(Vector3(x * angle_limit_for_rotation, 0.0, -z * angle_limit_for_rotation))
119+
return head.quaternion.slerp(target_rotation, speed_rotation * _delta)
121120

122121

123122
func _do_head_bob(speed: float, delta: float) -> Vector3:

0 commit comments

Comments
 (0)