/* */

Sunday 9 October 2011

buggy suspension dynamics



Quick test using maya's dynamics system and a poly helix which has a blendshap on it. There's a dynamic spring constraint which drives the position of the bottom of the spring.

Problem with this test is the bottom goes right through the top position due to the momentum on the first swing. In reality the upward motion would cause it to bend and move out in the x or z axis as it finds somewhere to go - the springs length cannot physically pass beyond a certain point.

This is not really an issue with a cars suspention because it is physically constrained by its pistons so cannot travel beyond its shortest point.

buggy suspension spring

Getting the suspension springs to behave right is fairly straight forward, but there are a few annoying pitfalls which will have you going in time consuming circles if you're not careful.
The springs are deformed using a blendshape - my first instinct was to use the helix's creation history height field to drive the stretch. Applying this I soon discovered the deformation occurs from the centre and expands out in the y axis, which is unrealistic. A car suspension springs deformation works from the top down.

To overcome this I used a MEL script called "spiral" which creates a cv curve with the height radius and coil number specified by the user.

The command is as follows:

spiral (Height, Radius, Coils)

The parameters should be identical to the poly helix's dimension's so the curve runs through it's centre you usually have to scale it in x -1 and rotate it in y by 180 degrees to match it up). Once the curve is created, attach it to the poly helix via a wire deformer, then add a joint chain which runs through the centre of the spiral (give it a generous amount).

Skin the joint chain to the spiral curve and scale each joint in x (excluding the end joint unless its oriented correctly). You should be getting a nice even deformation down the poly helix, with no flattening as it stretches.

Pitfalls

So up intil now, things have appeared pretty straight forward, but there are a couple of things to look out for when building this set-up.

flattening out:

Image left is the initial state of the spring - it has a spiral curve driving it which in turn is driven by a joint chain. So far so good. Next step is to test it out by scaling the joints (minus the last one) in x to stretch it out. 

When scaled in x it is painfully obvious the deformation is wrong - the spring flattens out at the bottom.This occurred because I initially build the poly helix with its coils too tight together, which means the wire deformer's coils are affecting more than one coil each. So this means going back, rebuilding the spring with more generously spacd coils and repeating the process - not the end of the world, but something to bare in mind from the start.




<< 01 02 03 04 05 06 07 08 09 10 >>