Transform Vector3f by Matrix4f

Rather important and useful method I threw together. Tested and working. Should be added to

Please add to the engine so that I don’t have to keep using my custom build.




  • <code>transformVect</code> transforms a given Vector3f by this matrix


  • @param vec
  •        the Vector3f to be rotated.<br />


public void transformVect(Vector3f vec){

Vector3f tmp = new Vector3f();

tmp.x = (vec.x * m00) + (vec.y * m01) + (vec.z * m02) + m03;

tmp.y = (vec.x * m10) + (vec.y * m11) + (vec.z * m12) + m13;

tmp.z = (vec.x * m20) + (vec.y * m21) + (vec.z * m22) + m23;

vec.x = tmp.x;

vec.y = tmp.y;

vec.z = tmp.z;


Yeah, you are right. I didnt remember transforming and multiplying were the same thing… Could you add this method anyway? as lots of bullet math uses “transform” instead of multiply.

No, we won’t have two methods that do the same thing with different names, what’s wrong with “mult”?

Generally, from what I have read about vector/matrix math and what I have learned in school, it has been referred to as transforming.

No… that’s not right. You can use a matrix to transform points by multiplication IF (and only if) that matrix is a transformation matrix.

There are any of a hundred reasons to use a matrix that are not transformations. Multiplying is the correct term. You are just using it for transforming.

Or…we don’t, and you use the Matrix4f.mult(Vector3f vec, Vector3f store) method :wink:

Okay, thanks for clearing that up :slight_smile: