Maya API
Attraction deformer
A Maya attraction deformer node.

Source code and demo files can be download from Github page.

introduction

Attraction Deformer demo

Maya offers many built in deformers to help modelers and animators to modify the mesh in a certain way to create required results. Sometimes the build in deformers may not meet the need of the end user. Fortunately, Autodesk offers Maya api to allow the plugin developer to create their own deformer node to meet some specific requirements.

I build up an attraction deformer which will attract or repel  the mesh vertices around a attractor. This deformer can used to create certain terrains or the cloth under certain forces. It can also combine with other deformer to create more creative effect. ( I am working on a deformer to  simulate wind blow.)

Features:

1.Switch the attractor behavior type: attract or repel.
2. Select falloff types: constant, linear or square.
3. Pinch value: the vertices move direction towards the attractor or along the normal direction.
4. Support deform weight paint.Custom attractor display size setting.

Coding tips:

1. There’s no need to add the affection to the properties that not involve in the deformation calculation.(e.g. the attractor display properties)
2. When access to the original mesh data, prevent using of “inputValue” which will set the node dirty and reperform the deforming computation. Use”outputValue” instead.
3. DagNode is the subset of DGNode, MfnDependencyNode can work on DagNode while MfnDagNode may not work with some DG nodes.
4. Thanks to Chad Vernon’s blog, this blog give me a lot of inspiration and help. 

Other projects