How to limit Look At 3D speed?

Godot Version

4.4.1

Question

I’m trying to set up a turret system using the Look At 3D node, and I’ve got everything else working except for limiting the speed how I like. While the time interpolation setting gets the right effect visually, I would like to limit the speed of the movement in general instead of having a set time. I’m assuming this would be done with a script, but I’ve yet to figure out how. For reference, I have one Look At node for rotation and another for elevation, each with their own bone to control.

for constant velocity, time and velocity are linearly dependent:

velocity = distance / time

So if you know two of those 3 values, you can easily calculate the third.

look_at is a method that does the rotation instantly.
you need to do a quaternion or basis spherical interpolation over time. for this you need to create a transform using a vector between the position of the tower and the target, and use looking_at.

this does the rotation in the Y axis:

var nod : Vector3 = Vector3(target.x, global_position.y, target.z)
if nod != global_position and nod != Vector3.UP:
	quaternion = quaternion.slerp(global_transform.looking_at(nod, Vector3.UP, true).basis.get_rotation_quaternion(), 0.1)

where 0.1 is the speed (the amount of interpolation that will happen during the frame.
this code should run every frame in physics_process.

Umm… if I understood correctly, the OP is using LookAtModifier3D on bones, which can gradually interpolate its orientation towards the target. The duration the transition can be specified via node’s property.

oh, sorry, that wasn’t very clear.
but a Node3D could still be used to rotate a bone or with a custom SkeletonModifier3D.

Node3D
	|-> LocalTarget

rotate the Node3D towards the enemy, the LocalTarget would be at a set distance, say, 10, and then set the LookAtModifier3D target to LocalTarget.

Always better to leave frame-by-frame work to native code in nodes, than doing it within processing functions in scripts.