Skip to main content

Creative Bloq is supported by its audience. When you purchase through links on our site, we may earn an affiliate commission. Learn more

Harmonic motion

When keyframing the motion of an object, it sometimes becomes clear that the motion follows a pattern, so there must be a better way to animate the object. This is especially true if the motion is simple but repetitive. Out of Range functions in 3ds Max can help, but they carry on until the end of the scene once applied, and this is often not flexible enough. In this situation, a neat bit of MAXScript may be just the answer.

One type of motion that is all around us, and therefore frequently animated, is oscillation: an object moving backwards and forwards. Most oscillating objects follow a simple rule called the sine wave, which has the distinctive mathematical property of having its speed and acceleration also defined by sine waves. This makes the motion of the object defined by the sine wave appear smooth and natural. Just about every programming or scripting language has the ability to apply the mathematical sine function, so it is relatively easy to write some script to animate objects oscillating. More importantly, once the script is written, it can be used over and over on different and multiple objects.

As soon as you begin to use the script, other benefits will become apparent. The parameters that define how the oscillating motion is to be applied can be easily altered through a simple user interface. The oscillating motion can be applied to a rotation, for objects like pendulums and bird wings; or a movement, such as IK chains in rigs. The script can include a Bake button that enables you to create keyframes within a predefined range, allowing other motion to be applied to the same object in the same scene. Indeed, the parameters can change during the animation to allow, for example, a pendulum to gradually come to rest.

The important parameter of phase can be altered on connected objects to create complex oscillating movement, like a multi-boned bird wing. It can also be applied at the sub-object level to the vertices within: for example, a plane to create realistic waves across the surface. When you think about it, the possibilities are endless.

Click here to download the support files (5.4MB)

Click here to download the tutorial for free