0 votes

I actually managed to make it sway left and right but I can't figure out how to do it vertically. Can someone please help me and explain what I have to add to the code?

extends Spatial

var mousemove
var sway
threshold = 5
var sway_lerp = 5

export var swayleft : Vector3
export var sway
right : Vector3
export var sway_normal : Vector3

func _ready():
pass

func input(event):
if event is InputEventMouseMotion:
mouse
move = -event.relative.x

func process(delta):
if mouse
move != null:
if mousemove > swaythreshold:
rotation = rotation.linearinterpolate(swayleft, swaylerp * delta)
elif mouse
move < -swaythreshold:
rotation = rotation.linear
interpolate(swayright, swaylerp * delta)
else:
rotation = rotation.linearinterpolate(swaynormal, sway_lerp * delta)

Godot version 3.4.1
in Engine by (14 points)
edited by

1 Answer

0 votes

https://www.youtube.com/watch?v=a07CBMlxqWY

Hopefully this video explains what you are looking for (not mine).

by (60 points)

This is gonna sound funny but actually I had no idea how to do the sway effect so I just watched Garbaj's second video on this topic, but it didn't explain how to do it vertically and I don't know how, so I'm just wondering what I can add to this.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.