Is it possible to use Slerp without a secondary "helper" object?

Please have a look at the picture below: it shows a simple setup consisting of a canon that rotates to the enemy. I already implemented it using the “transform.LookAt()” code and it works. But I am not satsfied with it because I want a small delay when the canon rotates. To achieve that I must use Quaternion.Slerp(from.rotation,to.rotation,time).

from.rotation = current rotation from the canon
to.rotation = final rotation once the canon targets the enemy

Now the question is: how do I get the “final rotation”?

I have implemented an “ugly solution”, which is: I added a small “pointer” object (which in fact is a secondary much smaller cube at the same position where the canon is) and which always instantly targets and looks at the enemy. From this object I take the so called “final rotation”. Now slerping works. However I think this solution is dirty, because it forces me to always have this additional “pointer object”. Isn’t there a way to determine the “final rotation”/to.rotation without this “helper”?

401544--13790--$canon.jpg

You want to use Quaternion.LookRotation( enemy.position - pivot.position ) as your to.rotation, I believe. :slight_smile:

Thank you, this works perfectly fine.