Notifications
Clear all
[Closed] Maxscript Exporter Problem
Jul 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 %
" keyFrame.time.frame to: file
format "% % % %
" q.x q.y q.z q.w to: file
format "% % %
" p.x p.y p.z to: file
)
...
Thanks in advance.
1 Reply
Jul 09, 2005 10:38 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