I have a simple fluid simulation set up and I'm trying to throw a cube of water at a wall (with the cube's flow behavior set to "Geometry" of course). But of course when I have the cube as geometry, even though I've animated it flying through the air, the fluid drops to the ground at the first frame. I want it to be thrown against the wall and I'm guessing I just have to keyframe a certain property to do this. How do I achieve throwing a geometry of liquid?

  • $\begingroup$ You might need to work with force fields, or maybe set the initial velocity of your cube to a non zero number. $\endgroup$
    – Eric Xue
    Sep 8 '20 at 18:19

There are (at least) two ways of achieving this, depending on the effect you are looking for.

The simplest case is to animate the geometry towards the 'wall' and to switch to fluid at the last moment. The key here is to use the Initial Velocity of the fluid 'Flow' object to give the liquid the same velocity as the moving mesh.

Initial Velocity

Ideally you would be able to simply use the 'Source' velocity (set to '1') to derive the velocity from the current velocity of the mesh. However, testing has shown that there seems to be a bug where under some circumstances the first frame of the fluid does not pickup the correct velocity (I've filed a bug report at Fluid Initial Velocity 'Source' incorrect when enabling Inflow) but it's fairly trivial to set the Initial X,Y,Z manually.

In order to achieve this, select your mesh on the frame before the impact and determine its coordinates in World Space. If you have animated your mesh using keyframes you can determine the location simply from the object's coordinates in the properties panel (N). However, if you're using, say, a Rigid Body simulation, you can determine the coordinates by first snapping the 3D cursor to the location of the mesh (select the object, press Shift+S, select Cursor to Selected) and view the 3D cursor coordinates from the 'View' properties panel :


Similarly determine the coordinates of the mesh at the point of impact and subtract the previous frame's position from it - the result is the X,Y,Z velocity of the mesh at the point of impact - use those to set the Initial X,Y,Z of the liquid.

set initial velocity

Now either set the Flow Behaviour to Geometry and set the simulation to start from that frame or set the Flow Behaviour to Inflow and keyframe the Use Flow to switch on the inflow on the frame of impact and off again afterwards. Note that using the Geometry method is slightly better as it will give you a precise volume of liquid but the Inflo method is better if you need the fluid simulation to begin before the impact (note that fast moving objects will create more fluid as the simulation will create enough fluid to 'fill in' the motion between one frame and the next).

By now switching visibility of objects and the fluid at the relevant points in your animation you should now be able to animate the mesh turning to fluid on the point of impact :

mesh to fluid1

Blend file included :

The more complicated solution is to have the mesh behave as liquid before the impact, staying together as that shape until the point of impact. The reason this is more complicated is that there is no simple method of keeping the fluid within the mesh until released by the impact - so we need to fool Blender into producing the effect using other means.

To achieve this, we'll use an Inflow (instead of Geometry) to generate the fluid as before - and also use the Initial Velocity to set it's velocity (in this case we can use 'Source' to set the velocity based on our object since it is a continuous Inflow so doesn't seem to suffer from the same bug).

In order to keep the fluid within the mesh we need to use an Outflow to remove everything that is outside of the 'inflow' geometry (the Inflow continuously adds fluid while the Outflow removes anything that isn't within an Inflow). This can be easily achieved by duplicating the Fluid Domain object and changing the type to Flow and Outflow. The Outflow should be 'enabled' until the point of impact.

Then, at the point of impact, we simply 'switch off' the Outflow and, a frame later, 'switch off' the Inflow - by animating the 'Use Flow' property. The resulting liquid should be moving at approximately the same speed as the mesh (there will be some difference as the fluid only takes on the Initial Velocity where it is new fluid added into the Inflow mesh - existing fluid is not affected by the Initial Velocity).

final result

Blend file included :


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.