0
$\begingroup$

I'm making a simulation that includes water knocking down a structure. But I don't know how to make the water have influence on it's surroundings, like simply pushing a block forward. If not, does anyone know how to add rigid-body to particles?

Here is what I have so far:

import bpy
# Delete everything in the blender file
bpy.ops.object.select_all(action='SELECT')
bpy.ops.object.delete(use_global=False, confirm=False)

# Create the cube that I want to push
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, 1, 1))
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.collision_shape = 'BOX'

# Here is where i tried to make the block push-able by liquid
bpy.ops.object.modifier_add(type='FLUID')
bpy.context.object.modifiers["Fluid"].fluid_type = 'EFFECTOR'
bpy.context.object.modifiers["Fluid"].effector_settings.surface_distance = 0.1

# Create the Floor
bpy.ops.mesh.primitive_plane_add(size=6, location=(0, 0, 0))
bpy.ops.rigidbody.object_add()
bpy.context.object.rigid_body.type = 'PASSIVE'
bpy.context.object.rigid_body.collision_shape = 'MESH'
bpy.ops.object.modifier_add(type='FLUID')
bpy.context.object.modifiers["Fluid"].fluid_type = 'EFFECTOR'
bpy.context.object.modifiers["Fluid"].effector_settings.surface_distance = 0.25

# Create the liquid source
bpy.ops.mesh.primitive_cube_add(size=2, location=(0, -2, 1))
bpy.ops.transform.resize(value=(1, 0.2, 1))
bpy.ops.object.modifier_add(type='FLUID') # Here is where I create the liquid
bpy.context.object.modifiers["Fluid"].fluid_type = 'FLOW'
bpy.context.object.modifiers["Fluid"].flow_settings.flow_type = 'LIQUID'
bpy.context.object.modifiers["Fluid"].flow_settings.flow_behavior = 'INFLOW'
bpy.context.object.modifiers["Fluid"].flow_settings.use_initial_velocity = True
bpy.context.object.modifiers["Fluid"].flow_settings.velocity_coord[1] = 0.5

# Create the domain
bpy.ops.mesh.primitive_cube_add(size=6, location=(0, 0, 1))
bpy.ops.object.modifier_add(type='FLUID')
bpy.context.object.modifiers["Fluid"].fluid_type = 'DOMAIN'
bpy.context.object.modifiers["Fluid"].domain_settings.domain_type = 'LIQUID'
```
$\endgroup$
8
  • $\begingroup$ As far as I know blender's simulations are not that complex yet. You can have rigid bodies bounce off water. Water can have rigid bodies act as collision objects for fluid. But you cannot have have fluid push an object. $\endgroup$
    – Yohello 1
    May 28 '20 at 21:34
  • $\begingroup$ Do you think we can add weight to particles? $\endgroup$ May 28 '20 at 21:36
  • $\begingroup$ No. We could try and predict how the water will flow and use force field to do this. Some time ago I did something similar to this in 2.79 I'll see if I can find the file. $\endgroup$
    – Yohello 1
    May 28 '20 at 22:00
  • $\begingroup$ Google drive will not let me get the file so I'll see if I can remember how to do it $\endgroup$
    – Yohello 1
    May 28 '20 at 22:21
  • $\begingroup$ Thanks, I appreciate that! $\endgroup$ May 28 '20 at 22:53

Your Answer

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

Browse other questions tagged or ask your own question.