Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Maxscript Export Help...

This topic is 5879 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I made a script that will export Mesh, Bones, Materials, and skin weights...Now I need to get the Animation Data. Below is a script that I wrote to do it, but it doesn''t seem to work 100% of the time...It fails when I have bones that are copied/mirrored (not a instance/ref)...Created bones come out fine. I guess i''m getting the Rotation and Position from the wrong place, but i''m not sure where else to look... I''m trying to get a Vector and Quaternion for each bone on each frame...If you could point me in the right direction, or show me a script that does it, that would be great. Thanks. Pardon the script, I just started learning it 2 days ago

file = createfile "c:\\temp\\test.ani"

b = for i in $* collect 
	if (classof i == BoneGeometry) then i else dontcollect

print (animationRange.end - animationRange.start) to:file
print TicksPerFrame to:file
if b.count > 0 then (
coordsys parent for i = 1 to b.count do (
	print b[i].name to:file
	for t = animationRange.start to animationRange.end do (
	at time t (
	print b[i].pos to:file 
	format "[%,%,%,%]\n" b[i].rotation.x b[i].rotation.y b[i].rotation.z b[i].rotation.w to:file


Share this post

Link to post
Share on other sites
I''m not sure what''s tripping you up, but one thing that may be causing your trouble is that by using "b[ i ].rotation" will give you the rotation in WORLD space....I believe. If you need to get the local rotation of the bone, then you want to do something like this:

( b[ i ].transform * inverse( b[ i ].transform).rotation

Just to explain this line above...By multiplying the objects transform with the inverse of it''s parent, that will give you the local transformation matrix of the object. From there, you can use the .rotation to get the rotation from that Matrix.

Another thing to be aware of, which may also be part of your problem is that every object in Max actually has TWO transformation Matrices. How do ya like that? There''s the normal one, which you can get with something like "b[ i ].transform". Then there''s an offset Matrix. I''m not aware of a way to get the whole Matrix itself directly(Maybe there''s a way?), but you can access it''s parts by saying:

b[ i ].objectoffsetpos
b[ i ].objectoffsetrot
b[ i ].objectoffsetscale

Oh yeah, I almost forgot another fun aspect. I believe that different parts(or maybe it''s different ways of accessing?) the transforms give you Matrices that are of different handedness!! For fun, try selecting a single object and typing the following into the listener:


...and notice how you get a bunch of different results back! The bottom line is that the way Max deals with transforms is a bit funky to say the least and can be terribly frustrating to figure out at times. But hopefully, even if the suggestions I gave you above don''t pan out, then by at least knowing about all of this funkiness you''ll be able to track it down. I heartily recommend reading up about the transforms in the Maxscript Help. Just do a search for "ObjectOffsetPos". That should get you to the relevant stuff.

Good luck!


Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!