gl-matrix
gl-matrix copied to clipboard
mat4 move
I think a mat4 move function is necessary if you want to move a matrix to a position. I have this:
/**
* moves a mat4 to vec3
*
* @param {mat4} out the receiving matrix
* @param {vec3} v the new coordinates to move to
* @returns {mat4} moved 4x4 matrix
*/
export function moveToVec3(out, v){
out[12] = v[0];
out[13] = v[1];
out[14] = v[2];
}
I'm sure others would find it useful too
A function to set the translation value to something is certainly useful. However, I'm not entirely convinced that it's really needed and thus worth the extra code.
You can already move a matrix using the translate
function. If you want to set the translation to a certain value, you can either directly modify the values or call getTranslation
and do the mathematics yourself.
yeah I know about the translate function, bu that 6 LOS function saves so much time, and the trouble to go through the mathematic
I fully agree that setter methods like mat4.moveToVec3
would be convenient. The downside is that I'd have to add all setter methods (consistency) which in turn would increase the file size. And then unit tests for everything would have to be written.
So, I'd love to see a compelling use case or a high demand before going through all that trouble.
Ah I see I underestimated the trouble, well hopefully there will be a higher demand!
Thank you for your time