Can anyone explain this script? It's the one attached to the motion field's magnitude and direction. If you delete it, the motion feild doesn't work proporly, but you can't adjust the magnitude of it otherwise. I can't make heads or tails of it.
float $x = pSphere1.translateX;
float $y = pSphere1.translateY;
float $z = pSphere1.translateZ;
float $to[3] = getAttr -time (frame - 1.5) pSphere1.translate;
$x -= $to[0];
$y -= $to[1];
$z -= $to[2];
float $len = sqrt( $x*$x + $y*$y + $z*$z );
if( $len > 0.00001 ){
$x /= $len;
$y /= $len;
$z /= $len;
}
motionField1.directionX = $x;
motionField1.directionY = $y;
motionField1.directionZ = $z;
motionField1.magnitude = motionField1.pushIntensity * $len*20;
surely you can't control the magnitude and direction directly,but you can do this by following:
1)add 4 attributes(just as dx,dy,dz and mag)to motionField1.
2)change the script to
........
motionField1.directionX = $x*motionField1.dx;
motionField1.directionY = $y*motionField1.dy;
motionField1.directionZ = $z*motionField1.dz;
motionField1.magnitude = motionField1.pushIntensity * $len*20*motionField1.mag;
then,you can control it by the attributes you added.
can you tell me the use of the motionfield? i never used it before,thank you~ 
the motion field is the field that was made with fluids in mind, other fields work on fluids b/c fluids worked around them. Motion field is a field placed on an objct that passes through the fluid and makes the fluid react to the object. It's a little unwieldy at times.
I'm still trying to understand the script that is attached to it. It seems too strong. I'll mess around with your sugestions, to see if they are the sripts that effects the fuild's reaction to the field.
Here's what I'm trying...
I have a grid cube of particles in a fluid contaner. The particles are effected by the fuild as a field. I add a sphere and a motion field in the center. As soon as I move the motion field everything goes crazy. the partiles fly down like there's gravity and some fly up like they got smaked really hard by the motion field, but I bearly moved the motion field. I'm hopeing to get a smother/more subtle reaction from the fuild to the particles... I'll try messing with the particles conserve, etc. to see if it's them that are the problem. I'd still like to understand what that scipt is saying.
Like does t say what ever direction in x,y,z move the fluid in that direction proportional to the distance?
ok it was my particles needing a lower conserve. Motion field works just fine. Thanks.
To adjust the magnitude of the motion field you need to use the attribute "pushIntensity" (under extra attributes in the attribute editor for motionField1). The expression sets the magnitude of the field, so this extra attribute was added because the expression connection blocks user editing of the magnitude. The motion field is really just a directional field with an added expression that sets the field direction and magnitude based on the motion of the field. It was designed so that a moving object could apply a push to a fluid node( fluid
collisions currently don't track the velocity of moving boundaries, so colliding objects don't push the fluid.. one must use the collision field for this ).
The field looks at the motion of an object( which it is parented to ), in the above case "pSphere1". It evaluates this objects position at the time 1.5 frames ago then subtracts this from the current position to get a velocity. The length of the velocity becomes the force magnitude and the normalized velocity becomes the field's direction.
Note that although it was designed for fluids, the motion field can be used with other dynamic elements, like particles and rigid bodies.
Duncan
Thanks for the explanation Duncan!
Thanks for the explanation.Dear Duncan! 