Jump to content

quat struct get matrix


photo

Recommended Posts

Posted

mat3 getMat3 ()

 

Obtains the quaternion's transformation matrix as mat3.

The transformation matrix is usually mat4. Can I just cast mat3 to mat4?

 

mat4 rotation = (mat4)quat.getMat3();

Posted (edited)

In fact, there's a constructor for mat4 that takes a quat.

(Edit: but a cast should work too, I think)

Edited by Greg.Mildenhall
Posted

Hi Dongju,

Greg's right, you can use either of them:

    mat4 rotation = mat4(quat.getMat3());
    mat4 rotation = mat4(quat);

Thank you!

×
×
  • Create New...