I wanted to add automatic rotation to steering behaviour during their execution. My current problem with rotation is like this: I have agent position who is supposed to rotate during steering behaviour and his current velocity. The agent is supposed to look in direction of his velocity. Agent have rotation speed and because of that transition is supposed to be expressed through tpf.
I think this is easy to do, but I simply don’t understand enough Quaternions. I saw Math for dummies, but that is not enough for me. Also can somebody recommend me some literature for it?
That didn’t help me. I know that much about rotation, I tried similar things and it didn’t work.
So whats your actual problem? Finding out the movement direction? Slerping the quaternions?
I made wandering steering behaviour. Agent seems to be moving fine with it. I just wanted to add rotation to this behaviour so the agent will always look in direction of the movement. I have trouble finding how to do that.
So why can’t you use the code I linked?
I don’t have fixed amountToRotate, I have vector to which agent have to rotate, but rotation of agent is in Quaternion, so I don’t know how to get angle between Quaternion that is agent current rotation and vector that is supposed to be final rotation.
But math for dummies shows you how to make a Quaternion from a direction vector? Then you could use Quaternion.slerp to interpolate.
Thanks I finally made it. This upVector was the one causing me the problem. Now it seems to be working.