0 votes

When using the look_at method on Node2D, the node is rotated immediately. This is somewhat unnatural, and would be nicer as a smooth transition. How can I smoothen the rotation when using Node2D.look_at()?

in Engine by (16 points)

2 Answers

0 votes

I don't think you can smooth it using look_at() but, knowing the starting and final angles of rotation, you could do that using a Tween and by calling interpolate_property on the rotation property of your node.
That way you get to specify the time and the easing methods to better tweak the result.

by (476 points)

Cool. Great suggestion!

I also added an issue on GitHub, where we can discuss improving the expressiveness of the look_at function with an added 'tween' argument.

+1 vote

you can use some null (dummy) object like Position3D or 2D .. make look_at() and then lerp between node and null object.

by (16 points)
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.