Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node3D
- var mouse_move
- var sway_threshold = 5
- var sway_lerp = 5
- @export var sway_left: Vector3
- @export var sway_right: Vector3
- @export var sway_normal: Vector3
- func _input(event):
- if event is InputEventMouseMotion:
- mouse_move = -event.relative.x
- func _process(delta):
- if mouse_move != null:
- if mouse_move > sway_threshold:
- rotation = rotation.lerp(sway_left, sway_lerp * delta)
- elif mouse_move < -sway_threshold:
- rotation = rotation.lerp(sway_right, sway_lerp * delta)
- else:
- rotation = rotation.lerp(sway_normal, sway_lerp * delta)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement