Converting rig controls rot values into rigid body "initial spin" attribute values

Hi all,

I’m working on several car crash animations in Maya where for example a car crashes and then barrel rolls down a hill, or crashes into another car and cartwheels.

I’m converting the vehicle mesh to a rigid body and switching to Maya dynamics part way through the animation.

for each animation I’m changing the ‘initial spin’ attributes on the rigid body, so that the car will start rolling in the correct axis when the simulation begins.

This all works fine, but the problem is that for a given animation the car could be in lots of different possible orientations at the point where the simulation is going to start, and the initial spin attributes represent world space values, so if for example I want the car to start barrel rolling(and so rotate laterally), it takes some trial and error to get the initial spin values correct, because they don’t correspond to the cars local rotation axis.

Because of this I would like to have an extra control in the vehicle rig(which I can rotate in the axis that the car should start spinning in) and then take the rotation values of this control and have them converted into the correct initial spin values? I’m having a problem getting the correct initial spin values from the control though.

As a quick test I created a cube in Maya, rotated it 45 in x(so that its orientated diagonally), then converted the cube to an active rigid body. I then gave “initial spin x” and “initial spin z” equal values of 4.
When I then hit play, the cube rotates along its local z axis.

So now I want to be able to have a node in the scene which I can rotate and have it create those same “initial spin” values.

Does anyone know how to do this?
Thanks for any help.

As for the first issue of having the initial spin in world space and your car in local space, you should be able to use the cars local space to find what that would be in world space and plug that into the initial spin values. To do this you need to use the cars direction vector to create a local matrix and then use that matrix to transform to the world matrix to find the correct rotational values for initial spin. Depending on your setup you may even already have a world matrix connection available from the car to input into the initial spin.

If you haven’t done much with matrices check out this link below. It’s a good starting spot. It can seam a bit confusing at first but it should be really helpful for better automating your initial spin without the guess work. Also all of this can be done through nodes in maya.

http://www.macaronikazoo.com/?p=395

As for the second issue… I’m really not sure why maya would be ignoring the other axis. I haven’t done much with rigid dynamics. Hopefully someone else can help out with that issue