gl-matrix icon indicating copy to clipboard operation
gl-matrix copied to clipboard

Vec4.transformMat4 producing weird results during projection

Open LoveenDyall opened this issue 7 years ago • 1 comments

Hi, initialising a Vec4 using fromValues(...) produces a Vec4. However, when I multiply this by the projection matrix using Vec4.transformMat4, I get extremely weird results and cannot perform mouse picking (conversion of 3d coordinates to 2d).

My current workaround is to use Vec3.transformMat4(...) on a Vec4 array.

LoveenDyall avatar Jan 22 '18 09:01 LoveenDyall

What sort of weird values are you seeing? I believe one of the only differences is that while vec3.transformMat4 performs the "W divide", vec4.transformMat4 does not (you must divide X, Y and Z by W to get the same values)

jameswilddev avatar Mar 24 '18 15:03 jameswilddev