For a game I'm making there is an AI bot in it. I want it to rotate so that it is facing it's opponent. The direction it is facing is determined by a vector (it will face the direction that the vector represents.) I can rotate it to face it's opponent like so:
glm::vec3 opponentRefPos = opponentPos - position; //for comparing AI's opponent's position to AI's position glm::vec3 directionTarget = glm::normalize(opponentRefPos); direction = directionTarget;
Where direction is the direction that the AI bot is facing (and it is a vec3) I want to gradually rotate it to face directionTarget. So let's say that I have a constant variable called SPEED (and deltaTime, which is the time between frames that SPEED will be multiplied by to keep the speed that it rotates at constant), which is the speed that I want the AI bot to rotate at. How can I rotate it towards this vector at that speed?