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

Thank you for reading 5 articles this month* Join now for unlimited access

Enjoy your first month for just £1 / $1 / €1

*Read 5 free articles per month without a subscription

Join now for unlimited access

Try first month for just £1 / $1 / €1

The Creative Bloq team is made up of a group of design fans, and has changed and evolved since Creative Bloq began back in 2012. The current website team consists of six full-time members of staff: Editor Kerrie Hughes, Deputy Editor Rosie Hilder, Deals Editor Beren Neale, Senior News Editor Daniel Piper, Digital Arts and Design Editor Ian Dean, and Staff Writer Amelia Bamsey, as well as a roster of freelancers from around the world. The 3D World and ImagineFX magazine teams also pitch in, ensuring that content from 3D World and ImagineFX is represented on Creative Bloq.