If I would like to multiply a Vector4 with a Matrix4x4 in Unity, what method can I use? I have only found Matrix4x4.MultiplyVector(), but as far as I understand this is for multiplying a matrix with a vector and this type of multiplication is not commutative.

Actually I am looking for the equivalent forms of XMVector3Transform and XMVector3TransformCoord.

  • 2
    \$\begingroup\$ Matrix multiplication is not commutative, full stop. You'll never get around that because spatial transformations themselves are not commutative. If you want to transform a relative/direction vector (w = 0, ignoring translation) then MultiplyVector is the right method. If you want to transform an absolute position vector (w = 1, including translation) then use MultiplyPoint. If you want something else, it would be good to edit your question to explain in more detail what you want and how it differs from these two methods. \$\endgroup\$
    – DMGregory
    Commented Mar 2 at 22:05


You must log in to answer this question.

Browse other questions tagged .