I've just started learning animation in Blender, and I've come across a problem with the cloth simulation. In the attached picture, I made a table, a plate, and a piece of cloth. The cloth is simply a plane with 50 subdivisions, and I turned on cloth simulation and self collisions. I added the collision modifier to both the table and the plate. When I run the simulation, the cloth deforms before hitting anything, and seems to pass right through the table and plate. Can anybody help? Thanks!
In the future, including a .blend file or a minimal working example script would be ideal because then we can directly diagnose any potential issues.
In lieu of that, here is a minimal working example script using Blender 2.82a with cloth collisions, which you can build upon for your own tests.
If this script is in a file called
test.py then you just have to run
blender -P test.py from your command line (e.g., this is usually Terminal or iTerm if you're on a Mac OS). Then this will open up Blender, and you can play around with the settings and observe what modifiers need to be present.
import bpy def clear_scene(): """Get rid of the starting cube.""" bpy.ops.object.select_all(action='DESELECT') bpy.data.objects['Cube'].select_set(True) bpy.ops.object.delete() def make_meshes(): """Make Suzanne mesh, with the collision modifier.""" bpy.ops.mesh.primitive_monkey_add(size=2, enter_editmode=False, location=(0, 0, 0)) bpy.ops.transform.resize(value=(2, 2, 2)) bpy.ops.object.modifier_add(type='COLLISION') def make_fabrics(): """Make fabric that drops over the Suzanne mesh and collides with it.""" bpy.ops.mesh.primitive_plane_add(enter_editmode=False, location=(0, 0, 0)) bpy.ops.transform.resize(value=(3.5, 3.5, 3.5)) bpy.ops.transform.translate(value=(0, 0, 6.0)) # Sub-divide into 50, like how you did it. bpy.ops.object.editmode_toggle() bpy.ops.mesh.subdivide(number_cuts=50) bpy.ops.object.editmode_toggle() bpy.ops.object.modifier_add(type='CLOTH') # Turn on collisions an increase the quality of the steps. bpy.context.object.modifiers["Cloth"].settings.quality = 10 bpy.context.object.modifiers["Cloth"].collision_settings.collision_quality = 5 bpy.context.object.modifiers["Cloth"].collision_settings.use_self_collision = True if __name__ == '__main__': clear_scene() make_meshes() make_fabrics()
A few additional comments about the code:
- It deletes the starting cube and adds a Suzanne mesh. I figured this would be more interesting, and it also shows how you need to add the collision modifier.
- The cloth is subdivided into 50 (like you did) with the collisions on.
Upon running the code, I end up with the following screen recording upon clicking "Play":
The cloth correctly collides with the Suzanne mesh, as desired, though it slows down a bit. :)