I really dislike rotation maths!

For the last couple of days and nights, I’ve been doing my best to try and get my Maya scripts working to convert XROMM animations into input files for LIGGGHTS.  I’ve previously done this for my paper with Stephen Gatesy, ‘The Birth of a Dinosaur Track’, but that was a) quite a while ago now, and b) all done manually.  I’ve been trying to get back into more simulations now that teaching is easing up [though marking is increasing!], so have spent all of the weekend, today, and this evening, trying to get my old partial scripts up to speed.

Here’s the input data, a Guineafowl walking on a solid surface (captured with XROMM, rendered in Maya):

bones.gif

The first problem is, all of the bones are in ‘CT space’, which means their rotation and translation points are not in sensible places.  The second problem is that Maya works in Euler rotations – a bone has an X rotation, a Y rotation, and a Z rotation.  The order matters too.  Sadly, LIGGGHTS requires rotations in axis-angle-period format, that is a bone is rotated about an origin, around an axis, at a certain speed.

Converting between these two is not trivial, and hurts my brain! I scoured the internet looking for sensible ways to do it, but seemingly always ran into issues. I even tried going via quaternions, but even after a fairly solid attempt, I had to back away beaten.

I also need to create cylinders to replace the bones (they’re not what you’d call ‘realistic’ but more suitable for a footprint simulation than using the bones directly, and far easier than attempting to model deformable soft-tissue.):

cylinders.gif

 

I also have tended to get various… problems:

reallywrong.gif

This could be due to the pivot being at the wrong place relative to the bone…

wrong-3.gif

…It could be down to my using the wrong rotation order…

wrong-1.gif

…It could be for some reason I just couldn’t fathom.

As you’ll notice in the animations above, segments have a nasty habit of twisting apart in ways they are not meant to be, or translating when they should just be rotating.

Anyway….  I think I’ve about got it solved.  I now have a set of scripts that will create cylinders of the right length, move the pivot to the appropriate place, move the cylinders to the correct locations, and orient them accordingly, bake the animation to the cylinders, Euler filter the curves (oh boy did 178, 179, 0, -1 catch me out more than once!), and then produce input files for LIGGGHTS:good.gif

I think this is working pretty well (there are a few small issues with alignment that need smoothing out by hand.

The script set are still buggy as all heck, but I do plan on making them available when they are working correctly.  Mainly so I don’t have to go through all this again when I inevitably lose them, or overwrite them with broken versions!  And all it took were some long nights and some serious head banging!

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Website Built with WordPress.com.

Up ↑

%d bloggers like this: