Make an object float

   2692   1   1
User Avatar
Member
12 posts
Joined: Dec. 2013
Offline
Hello,
I am trying to make an object float on the surface of a large flip simulation. It takes ages for me to make it float using Feedback scale or Fluid force Dop node. So is there any way I can make the object follow some point/points on the surface node by expressions? (I dont really need the object to interact with the water or produce whitewater. Just floating would be great)

I tried selecting a point and using Point expression to make my object float. Since the number of points on the surface keeps changing, this approach doesn't work.

Thanks,
User Avatar
Member
48 posts
Joined: June 2011
Offline
If you output the “surface” field from the FLIP sim, you can sample the value of the field at any arbitrary point to get the distance to the nearest point on the fluid surface (negative distances mean the point is inside the fluid), and sample the gradient of the same field to get a normal-vector that points towards that nearest point. Multiply them together, and you get an offset that you can use to translate your object to that nearest point on the surface.

(Look for the Volume Sample and Volume Gradient nodes inside a VOPSOP)

If you then animate the point you're sampling at, you could animate the object sliding around on the surface.

This will only work nicely for relatively calm fluids… if there's lots of splashing, it'll still cause the object to jump around a lot, unless you work in some sort of multiple-point filtering or something like that.
  • Quick Links