1
$\begingroup$

I'm thinking weight paint but maybe I mean Dynamic Paint or even something else I'm unaware of. I have cell fractured a long thin cylinder which I am dropping onto a plane using Blender 2.71 Render (not BGE). It has been rotated a little so that its contact with the plane starts at the lowest shard and works its way to the top. Of course, the whole thing simply falls apart on first contact. So, I use rigid body constraints and this works fine keeping it together. What I want, however, is a progressive shatter as the cylinder shards come into contact. In other words, I want the shards which have not yet reached the plane to stay intact. Keyframing this one shard at a time is tedious, prone to error, and all but impossible when there are hundreds of shards.

Can I use weight paint or anything else to control the enable function (or any other property or function) associated with the constraints to switch from enabled to not enabled as a function of time (or frame number)(in other words, as a function of color)?

$\endgroup$
2
$\begingroup$

I'm sure you could do this with weight paint, however, I think it might be overkill. Weight paint and dynamic paint is per vertex, and bullet collision settings are per object.

You can animate the constraint Enabled variable. and you can also add a driver.

The following code will work on an object I fractured using Cell fracture, the object named "Cube". Then I used the Bullet Constraint tools 'Single constraint' to make the constraints. This code won't work if you have used Empties to constrain the objects together.

Link to a blend file

Press alt A, you will see the box stays together. Run the script (alt P in textblock) and then animate again. You will see the box stays together, until the plane moves above each object.

object_name = "Cube"

import bpy

for obj in bpy.data.objects:
    if  object_name+"_cell" in obj.name:
        driver = obj.rigid_body_constraint.driver_add('enabled')
        driver.driver.expression="this_obj<mask_obj"
        driver_variable = driver.driver.variables.new()
        driver_variable.name = "this_obj"
        driver_variable.type = 'TRANSFORMS'
        driver_variable.targets[0].transform_type = 'LOC_Z'
        driver_variable.targets[0].id = driver_variable.id_data    

        driver_variable = driver.driver.variables.new()
        driver_variable.name = "mask_obj"
        driver_variable.type = 'TRANSFORMS'
        driver_variable.targets[0].transform_type = 'LOC_Z'
        driver_variable.targets[0].id = bpy.data.objects['mask']  

drivers

$\endgroup$
0
$\begingroup$

Use breakable constraints

https://www.youtube.com/watch?v=UozbIssdhSI

General overview:

  1. Make all objects "active" by pressing "Add Active" on Physic pane
  2. Select all objects and click "Connect" to make constraints
  3. Select a constraint empty, and go to its Physics tab in Properties window
  4. Check breakable box and adjust desired force
$\endgroup$

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.