thanks Jooja
I had already kinda figured it out... I knew it was easy...
What I am doing is getting velocity information of the voxels from a 2D fluid and using these vectors to move points in a grid... it is working ok by now ![]()
CODE
######## PYTHON CODE ###########
import maya.cmds as cmds
def movePoints():
#to run this, select the locators
locs = cmds.filterExpand(sm=22)
fluid = "fluid_2DShape" #name of the fluid container
for l in locs:
#position of locator
pos = cmds.pointPosition(l)
#find out on which voxel the locator is located
cmds.select(fluid, r=1)
vx = cmds.fluidVoxelInfo(voxel=pos)
#get the velocity vector of this voxel
d = cmds.getFluidAttr(at="velocity", xi=vx[0], yi=vx[1], zi=vx[2])
#get the magnitude of this vector
magCmd = "mag <>;" %(d[0], d[1], d[2])
mag = mm.eval(magCmd)
#unitVector = [d[0]/mag, d[1]/mag, d[2]/mag]
#move point along vector
f = 20 #reducing factor
cmds.move(d[0]/f, d[1]/f,d[2]/f, l, r=1)
#draw a line to see where it went
pos1 = cmds.pointPosition(l)
cPoints = [pos, pos1]
cmds.curve(p=cPoints, d=1)
The locators above are place in each of the grid points....
Nothing fancy, but it is working the way I wanted....
Thanks!
lg,
Daniel