PDA

View Full Version : Maxscript Exporter Problem


Titonus
07-09-2005, 10:38 AM
Hi, I'm doing a bone exporter which exports the ID, number of childs and bone's local matrix but I don't know how I can get correctly the bone's keyframes data relative to its parent (rotation: quaternion and translation: position).
Now I do as follows:

...
at time keyFrame.time
(
-- Rotation, we change Y and Z axis (DirectX) and so we use a matrix (mquat)
q = bone.rotation

local mquat=q as matrix3

local row1 = mquat.row1
local row2 = mquat.row2
local row3 = mquat.row3

row1 = switchYZ row1
row2 = switchYZ row2
row3 = switchYZ row3

mquat.row1 = row
mquat.row2 = row
mquat.row3 = row

mquat = inverse mquat
q = mquat as quat

-- Translation, we change Y and Z (DirectX)
p = bone.pos

p.y = bone.pos.z
p.z = bone.pos.y

-- Write output file
format "KeyFrame %\n" keyFrame.time.frame to: file
format "% % % %\n" q.x q.y q.z q.w to: file
format "% % %\n" p.x p.y p.z to: file
)
...


Thanks in advance.

ofer_z
07-10-2005, 08:23 AM
just put whatever commands you want in parent coordinates in a "in coordsys parent" scope:
in coordsys parent (
-- commands in parent coordinate system go here
)

hOpe this helps,
o

CGTalk Moderation
07-10-2005, 08:23 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.