I`m working on a custom field node.
For that, I need to exactly define the output of the field: the outputForce attribute.
I found out that the outputForce varies with the Maya workingUnit.
The following formula relates the outputForce to the workingUnit:
outputForce = distance * pow( framerate, 2 )
If we have a framerate of 25 fps and we want the particle to move 10 cm, we need the following outputForce:
outputForce = 10 * pow( 25, 2 ) = 6250.
( of course, I talk about just on axis )
This formula works perfectly for the devkit example fields.
But it does not work for my own field.
I must have missed something, but I cannot figure out what.
So, is there anybody with experience in this field ( and with the field ;] ) ?
edit:
I wanted to add the important parts of the code.
In the devkit torusField example, the end of the ::compute looks like this:
forceArray[0].x = 10000;
forceArray[0].y = 0;
forceArray[0].z = 0;
// Get output data handle.
MArrayDataHandle hOutArray = data.outputArrayValue( mOutputForce, &stat );
MArrayDataBuilder bOutArray = hOutArray.builder( &stat );
// Get output force array from data.
MDataHandle hOut = bOutArray.addElement( multiIndex, &stat );
MFnVectorArrayData fnOutputForce;
MObject dOutputForce = fnOutputForce.create( forceArray, &stat );
// Update data data with new output force data.
hOut.set( dOutputForce );
data.setClean( plug );
and the end of my fieldNode looks like this:
forceArray[0].x = 10000;
forceArray[0].y = 0;
forceArray[0].z = 0;
// Get output data handle.
MArrayDataHandle hOutArray = data.outputArrayValue( mOutputForce, &stat );
MArrayDataBuilder bOutArray = hOutArray.builder( &stat );
// Get output force array from data.
MDataHandle hOut = bOutArray.addElement( _multiIndex, &stat );
MFnVectorArrayData fnOutputForce;
MObject dOutputForce = fnOutputForce.create( forceArray, &stat )
// Update data data with new output force data.
hOut.set( dOutputForce );
data.setClean( plug );
Just to make clear that there is no difference at all....