Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

glm - Decompose mat4 into translation and rotation?

For purposes of lerping I need to decompose a 4x4 matrix into a quaternion and a vec3. Grabbing the quaternion is simple, as you can just pass the matrix into the constructor, but I can't find a way to grab the translation. Surely there must be a way?

like image 835
Silverlan Avatar asked Jul 29 '13 07:07

Silverlan


1 Answers

glm::vec3(m[3]) is the position vector(assuming m is glm::mat4)

like image 148
kerim Avatar answered Sep 28 '22 03:09

kerim