Hey guys, how can I smoothly LookAt something? I’ve got a simple enemy that is going from Idling to Walking and facing the player.
I’m scripting with Lua. Obviously, this works:
enemyNode:LookAt(targetPosition)
but also obviously, that’s too immediate.
Years ago (maybe 7) with Unity I recall doing the same thing with either Lerp or Slerp. How can I do a simple LookAt rotation over time in Urho3d?
In Unity it would apparently be something like this below, but there is no RotateTowards for Vector3s in the lua API.
targetRotation = Quaternion.LookRotation(object.position - target.postion);
object.rotation = Vector3.RotateTowards(Object.rotation, targetRotation, Time.deltaTime * turnSpeed)
I’ve tried the following:
enemyNode.rotation = Quaternion(degree, Vector3(0, 1, 0))
but I can’t figure out how to find the right degree and then move to it over time. In Urho3d, what’s the best way to do this?