Hi, here is the small tutorial for
implementing a self collision for maya particles.
This tutorial shows you a step by step
process of implementing particle self collision using radial field.
At the end of this tutorial I also
added a small MEL script to automate the whole process.
Self collision step-by-step:
- go to particles>create Emitter.
- select particle shape node and apply gravity field, go to fields>gravity.
- Create a poly Plane. Select particle shape node and plane and go to Particles>Make collide.* It is not necessary to make a particle collide with some surface it just to see the effect of self collision.
- Again select particle shape node and apply radial field to it, go to fields>Radial.
- Select radial field and then particle shape node and go to fields>use selected as source of field.
- Now select the radial field and open channel Box and turn on ApplyPerVertex attribute.
- Now adjust the maxDisatnce of radial field to get the desired effect.* the maxDistance used in a given example is 0.6 .
now play the animation to see the self
collision in effect.
MEL Script:
/*
Hemant singh
particle self collision
*/
proc particleSelfCollision()
{
string $sel[] = `ls -sl`;
string $getShapeNode[] = `listRelatives -s -noIntermediate $sel[0]`;
// check: the selected object is a particle node
if(`nodeType $getShapeNode[0]` == "particle")
{
// create gravity field
string $grvtNode[] =
`gravity -pos 0 0 0 -m 9.8 -att 0 -dx 0 -dy -1 -dz 0 -mxd -1 -vsh none
-vex 0 -vof 0 0 0 -vsw 360 -tsr 0.5`;
connectDynamic -f $grvtNode[0] $sel[0];
// create radial field
string $radlNode[] =
`radial -pos 0 0 0 -m 1 -att 1 -typ 0 -pv 1 -mxd 0.6 -vsh none -vex 0
-vof 0 0 0 -vsw 360 -tsr 0.5`;
connectDynamic -f $radlNode[0] $sel[0];
addDynamic $radlNode[0] $sel[0];
}
else
{
error ( "Selected object is not a particle object." );
}
}
Cheers....