4

I have a model that I cell fractured and I would like the cells to fall down one after another from top to bottom, like a kind of wipe. Is there a way to activate the rigid body simulation of these hundreds of shards depending on their distance to another object (an empty or anything else) ?

It's basically the same question as this one, but for blender 3.0 : Turn on rigid body by means of distance

Or this tutorial, but for 3.0 : https://www.youtube.com/watch?v=pEd0NuiMG3E

Thanks a lot for the help.

Fab P
  • 61
  • 3

1 Answers1

3

UPDATE:

if you change the script like this:

import bpy

two sample functions

def calcActivating(object):

objectName = object.rna_type.id_data.name

location1 = bpy.context.scene.objects[objectName].location
location2 = bpy.context.scene.objects["Empty"].location

print("distance is", (location2 - location1).length)

return (location2 - location1).length > 5

Add functions defined in this script into the drivers namespace.

bpy.app.driver_namespace["calcActivating"] = calcActivating

And if you add an Empty with the name "Empty" (or adapt the script) it will react (change the animated property) depending on the distance.

possible result:

enter image description here


if you run this script:

import bpy

two sample functions

def calcActivating(object):

objectName = object.rna_type.id_data.name

location1 = bpy.context.scene.objects[objectName].location

return location1.z - (bpy.context.scene.frame_current / 30) > 0

Add functions defined in this script into the drivers namespace.

bpy.app.driver_namespace["calcActivating"] = calcActivating

and then give to one fractured cell for "animated" property ....

enter image description here

this driver:

enter image description here

then select all cells, shift select your cell with the driver at last, press CTRL-L -> animation data.

then you can get this:

enter image description here

of course you can change the "30" to any other value to change the effect:

enter image description here

Note: I just took the location.z value as "timing" function. So your location.z values of all fractured cells should be > 0 in the beginning of the animation. Of course you can take also a distance to another object or whatever function you want to calculate the timing.

Chris
  • 59,454
  • 6
  • 30
  • 84