VEX transform matrix from 4 vectors (frame + translation)

   3893   2   1
User Avatar
Member
30 posts
Joined: Jan. 2015
Offline
Hi everyone,

I'm trying to build a transform matrix from 4 vectors but I'm having some problems initializing my matrix.

Here is what I've be trying so far:
matrix m = { {vTangent.x, vTangent.y, vTangent.z, 0}, {vNormal.x, vNormal.y, vNormal.z, 0}, {vBiTangent.x, vBiTangent.y, vBiTangent.z, 0}, {vPos.x, vPos.y, vPos.z, 1}};

but it gives me the error “Syntax error, unexpected Identifier”.
If I try with hardcoded constant values instead of variables I do not have the error. So I assume that I can't initialize from variables.
I then tried declaring a matrix and modifying the components afterwards, but no success neither…
m = vTangent.x;
Gives me the error "Call to undefined array index operator matrix“.

When I look at the code from a ”Float to Matrix" node I get:
// Code produced by: floattohmatx1
hmatx = vop_floattomatrix(fval11, fval12, 0, 0,
0, 1, 0, 0,
0, 0, 1, 0,
0, 0, 0, 1);

However, I do not see where this function is implemented.

So my question is how do you build a matrix from vectors or from floats in VEX?

Any help would be appreciated
User Avatar
Member
5 posts
Joined: Feb. 2015
Offline
{} array does not take variables. Use set() instead
User Avatar
Member
30 posts
Joined: Jan. 2015
Offline
Ahhhh, that's what I was looking for!
Thank you Fez.
  • Quick Links