Well, a while ago I thought I had this problem sorted.. But it seems that the magical pony that is 3ds max has given me another curve ball.. Recently myself and my group discoed, that even though we set our units to 1m = 1 unit, things as such as obj exporters and function calls inside of maxscript (body.pos.z) on the other hand were using data that was 40x as large.. (we are using the build in .obj exporter in 3ds max) I could get the actual units through use of:
fn getFormated unFormated =
(
brokenUp = filterstring (units.formatValue unFormated) "m"
return brokenUp[1]
)
which this fixed both scale and position.. however.. it seemed to have broken rotation aswel.. Which is just dandy..
this is my old exporter for pos, rot, scl
format "\t\t<position> " to:currentFile
format "% " body.pos.x to:currentFile
format "% " body.pos.z to:currentFile
format "% " -body.pos.y to:currentFile
format "</position>\n" to:currentFile
format "\t\t<rotation> " to:currentFile
format "% " body.rotation.w to:currentFile
format "% " body.rotation.x to:currentFile
format "% " body.rotation.z to:currentFile
format "% " -body.rotation.y to:currentFile
format "</rotation>\n" to:currentFile
format "\t\t<scale> " to:currentFile
format "% " body.scale[1] to:currentFile
format "% " body.scale[3] to:currentFile
format "% " body.scale[2] to:currentFile
format "</scale>\n" to:currentFile
and this is the new, which exports correctly scaled data (with an exception to the now broken rotation)
format "\t\t<position> " to:currentFile
frmtd = getFormated(body.pos.x)
format "% " frmtd to:currentFile
frmtd = getFormated(body.pos.z)
format "% " frmtd to:currentFile
frmtd = getFormated(-body.pos.y)
format "% " frmtd to:currentFile
format "</position>\n" to:currentFile
format "\t\t<rotation> " to:currentFile
format "% " body.rotation.w to:currentFile
format "% " body.rotation.x to:currentFile
format "% " body.rotation.z to:currentFile
format "% " -body.rotation.y to:currentFile
format "</rotation>\n" to:currentFile
format "\t\t<scale> " to:currentFile
frmtd = getFormated(body.scale[1])
format "% " frmtd to:currentFile
frmtd = getFormated(body.scale[3])
format "% " frmtd to:currentFile
frmtd = getFormated(body.scale[2])
format "% " frmtd to:currentFile
format "</scale>\n" to:currentFile
is there some way to apply:
units.formatValue
to a x,y,z,w rotation???
barigazy · 2012-09-26