[Closed] converting pos and rot values to a new matrix
something like this should do the job
struct conMan
(
sys = 1,
maxcoord = #(1,2,5,3,1,0),
d3dcoord = #(0,2,3,5,1,1),
oglcoord = #(1,2,3,6,1,1),
xyz = matrix3 1,
coords = #(maxcoord,d3dcoord,oglcoord),
axis = #([-1,0,0], [1,0,0], [0,0,1], [0,0,-1], [0,1,0], [0,-1,0]),
public
fn BuildTransform s = ( xyz = matrix3 axis[coords[s][2]] axis[coords[s][3]] axis[coords[s][4]] [0,0,0]),
fn convertPoint pnt = (pnt * xyz),
fn convertMatrix tm = (xformMat tm xyz),
fn convertEuler euler = ((xformMat (euler as matrix3) xyz) as eulerangles;),
fn invertXYZ = xyz = inverse xyz,
fn getXYZ = xyz,
on create do BuildTransform sys;
)
maxtogl = conman 3
gltomax = conman 3
gltomax.invertXYZ()
a = maxtogl.convertEuler (eulerangles -23.5 145 -15.0)
gltomax.convertEuler a
the last snippet of code illustrates some of the issues of euler angles as there is more than one rotation that gives the same result.
The current state I have is things show up in the correct position, but with rotations that seem off by 90 degrees in one axis, some of the time. It’s not a complete blocker since we have in-engine tools for tweaking these values too.
Klunk -thanks a ton for all this info, it will be helpful.
I need to move on to other tasks, but I will pour over your posts when I have time.
At first run it seem to work, but I will definitely have under the hood questions
(if you woud indulge me)
Igame looks like it has been unsupported since Max 8…is it still alive?
I’m using the 2010 SDK version… think it was renamed for later releases. It’s very useful for this kind of thing and it’s mesh accessing tools are great.