blender-physics-simulation
Blender Physics Simulation - traps
Traps 1-5 measured headless on Blender 5.1.2 (blender-round3 probes, 2026-11-08); trap 6 is the live-GUI crash from the round-3 ph2 run.
-
Baking IS scriptable - but set
cache_typefirst. Wrong: assuming bakes are UI-only, or baking a domain left at the defaultcache_type = 'REPLAY'-bpy.ops.fluid.bake_all()then writes ONE data file (frame 1) whilehas_cache_baked_datastill reads True. Right:domain_settings.cache_type = 'ALL'(or'MODULAR'), thenwith bpy.context.temp_override(active_object=domain, object=domain): bpy.ops.fluid.bake_all()(FINISHED, 5 vdb files for 5 frames at 16 divisions, 0.09 s). Rigid / particle / cloth point caches bake withbpy.ops.ptcache.bake_all(bake=True)(FINISHED,point_cache.is_bakedTrue). Bakes block until done - keep scripted ones small. Verify: COUNT the files in[cache_directory]/data, never trust the baked flag. -
Rigid bodies only simulate when frames are stepped in order, or after a bake. Wrong:
frame_set(1)thenframe_set(20)- a falling cube stays at z = 5.0. Right: step 1..20 sequentially (z = 1.9425 at 20, 0.4983 at 40) or bake first. Verify: readobj.matrix_world.translationafter the steppedframe_set.