The Godot Q&A is currently undergoing maintenance!

Your ability to ask and answer questions is temporarily disabled. You can browse existing threads in read-only mode.

We are working on bringing this community platform back to its full functionality, stay tuned for updates. | Twitter

0 votes

Hi I've just implemented some steering code for a player sprite, and in the interests of learning I've implemented it in a few different ways for testing purposes.. Basically for rotation I've tested linear_interpolate, lerp_angle, and also a tween node. The tween node offers a number of transition options so I think I'd go with that.. but I'd like to know in the interests of "best practice", do I need to be wary of using tweens arbitrarily - ie is there a performance hit? For example I intend to use this same steering code for NPCs also.

in Engine by (16 points)
edited by

1 Answer

0 votes

for rotation I'm going to use lerp_angleto interpolate as it finds the shortest angle between current direction and the target direction.

    global_rotation = lerp_angle(global_rotation, target_dir.angle(), steer_force.length() * _delta)
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 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 [email protected] with your username.