[ADD] made camera follow the character with lerp

This commit is contained in:
Nathalie Seen
2021-06-08 10:55:48 +02:00
parent 86383aace5
commit edbbfb136a
6 changed files with 35 additions and 4 deletions

View File

@@ -31,4 +31,17 @@ namespace toolbox
matrix = glm::translate(matrix, negative_cam_pos);
return matrix;
}
float Lerp(float from, float to, float amount)
{
return from + amount * (to - from);
}
glm::vec3 Lerp(glm::vec3 from, glm::vec3 to, float amount)
{
glm::vec3 final;
final.x = Lerp(from.x, to.x, amount);
final.y = Lerp(from.y, to.y, amount);
final.z = Lerp(from.z, to.z, amount);
return final;
}
}

View File

@@ -46,4 +46,8 @@ namespace toolbox
* @return: The view matrix
*/
glm::mat4 CreateViewMatrix(entities::Camera& camera);
float Lerp(float from, float to, float amount);
glm::vec3 Lerp(glm::vec3 from, glm::vec3 to, float amount);
}