flopoloco's picture

Multiplying a vector with a matrix

What is the preferred way to multiply a vector with a matrix?

Seeing these methods are not exactly suitable.
Matrix4.Mult
Vector3.Multiply

Any ideas?


Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Frassle's picture

Look at the Vector Transform methods var result = Vector3.TransformVector(vector3, matrix4).

You may also want TransformNormal and TransformPoint depending on what transform you need.

flopoloco's picture

Wow, I did not expect that. I would hope that this functionality could better go for the multiply method (or the binary operator), but anyway, this is only a matter preference.

Thanks Frassle, this helped.

Frassle's picture

It's kinda common for math libraries aimed at gamedev to call it transform instead of multiply. SharpDX, XNA (and thus MonoGame) all use Transform instead of Multiply.