0 votes

I'm making a 3D game but the camera is fixed to make it look like an isometric game, like how Project Zomboid's camera is set up.

I have a 3D object which is just a simple cube sitting on a 3D Mesh (Supposed to be my player). I've used the following code to make it look at the mouse:

func _physics_process(delta):
var from = $Camera.project_ray_origin(get_viewport().get_mouse_position())
var to = from + $Camera.project_ray_normal(get_viewport().get_mouse_position())
$Player.look_at(to, from)

all is well except that the whole cube is rotating in all axis, I just want it to rotate on its y axis, essentially locking the x and z axis to zero. How can this be achieved? Thank you!

in Engine by (104 points)
edited by

I'm having the same exact issue. Did you find a solution??

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 Frequently asked questions and 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.