0
101 Mar 14, 2008 at 22:34

Hi there,
I’m writing a simple exporter for 3dsmax to export to a particle engine in Flash, however I’m running into issues that are a bit beyond me.

I’ve managed to do the first bit, which is to transform coordinates using a matrix:

mxYUp = matrix3 [1,0,0] [0,0,1] [0,-1,0] [0,0,0]
mxCam = cam.transform

mxCamYUp = mxCam * mxYUp
mxCamYUp.rotation as eulerangles

however, my rotations seem to have an extra -180 degrees on them.

[-180,0,0]

Can anyone explain what I should be doing here? The guy doing the Flash side reckons that the rotations should come out as [0,0,0] which seems fair to me if that’s what they are in 3dsmax anyway.

Can anyone shed any light?
Thanks,
Dave

#### 2 Replies

0
101 Mar 17, 2008 at 19:10

hi,

i assume that cam.transform is a 3x3-matrix, mxYUp a 3x3 matrix and mxCamYUp a 3x3 matrix (dunno why you’re using a fourth line for matrix3):

you’re aiming for
cam.transform * mxYUp = Identity =
1 0 0
0 1 0
0 0 1

and you’re actually having
cam.transform * mxYUp = mxCamYUp =
1 0 0
0 -1 0
0 0 -1

with mxYUp =
1 0 0
0 0 1
0 -1 0
(rotation by 90° around the x-axis)

Inverse Matrix of mxYUp = Transpose(mxYUp)
=> cam.transform = mxCamYUp * Transpose(mxYUp) =
1 0 0
0 0 1
0 -1 0

so your camera transformation is a rotary matrix, rotating 90° around the x-axis. therefore your product-matrix mxCamYUp is a rotation around 180°, which is what your euler angles are proving.

to get identity, you therefore have to change mxYUp to
mxYUp2 =
1 0 0
0 0 -1
0 1 0

0
101 Mar 29, 2008 at 00:25

Hey Omni,
Thanks for the help! I managed to do it in the end, but I’ll check out your solution as well.
Cheers for chipping in,
Dave