+1 vote

Here, why not use the head for the shake y-axis of the mouse, but use the head to restrict the x-axis of Godot, which is the same the mouse y-axis?

on ready var head = $Spatial

func _input(event):
if event is INPUTEVENTMOUSEMOTION:

rotate_y(deg2rad(-event.relative.x * 0.03))

head.rotate_x(deg2rad(-event.relative.y * 0.03))

head.rotation.x = clamp(head.rotation.x , deg2rad(-70), deg2rad(70))

in Engine by (179 points)
edited by

Please log in or register to answer this question.

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.