Attach fixed constraints to all objects

Share your scripts with other members
shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Attach fixed constraints to all objects

Postby shaun_michael » Mon Sep 24, 2007 1:48 pm

Hi,



Some of you may be familiar with the digital-tutors dynamics DVD. In there they show you how to write a script that attaches all your RBD objects together to allow you to have a multi-piece object remain as one piece until either a set frame or a set force acts upon it. Its a variation of dynamic_boy's attachator script except that it fixes each object to every other object (and isn't quite as tidy :) )

I have written out a similar script and made one or two changes to the original to make it a little more flexible (ie entering variable values at the top of the script instead of hunting through it, and allowing either breakable frame or breakable force automatic - the original was hard coded to only be breakble force)

Just playing with it now. As in the DVD, sometimes RF crashes. Just try again - oh and save your scene before you run the script :)

Ways to improve it?
Adding another UI so that you can add a numeric value for either force of frame instead of having to edit the script directly.

Have the fixed constraints automatically added to their own Group


Fixed Constraint to all pieces Batch Script

Shaun


phormas
Posts: 18
Joined: Sat Sep 19, 2009 2:38 pm

Attach fixed constraints to all objects

Postby phormas » Thu Feb 18, 2010 9:21 am

Once this script is applied to some geometry, is it possible to give the "new attached object" cloth or elastic properties?

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Attach fixed constraints to all objects

Postby shaun_michael » Thu Feb 18, 2010 10:21 am

Consrtaints only work on rigid body objects I'm afraid.

Shaun

User avatar
bitSeq
Posts: 1044
Joined: Thu Jul 10, 2008 9:48 am
Location: UK - Stuart Armiger
Contact:

Attach fixed constraints to all objects

Postby bitSeq » Thu Feb 18, 2010 6:24 pm

Hi Shaun, very handy! Thanks.

tint
Posts: 2
Joined: Sun Mar 28, 2010 5:02 pm

Attach fixed constraints to all objects

Postby tint » Sun Mar 28, 2010 5:09 pm

hi!
ive also been looking thru that dvd and copied his script.
The problem I have though is that my project is slightly more complicated.
I have an object with over 500 shards. Idealy I would like it to have even more shards.
With that script it would generate 250000 constraints? (500x500, or how does it work?)
I let it run for a couple of hours and still only had about 4k of the constraints setup.

In the dvd he says something about there might be a way to use some form of distance object detection or such.

Anyone how knows something about that?

cheers
Martin.

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Attach fixed constraints to all objects

Postby shaun_michael » Mon Mar 29, 2010 7:47 am

In the dvd he says something about there might be a way to use some form of distance object detection or such.

He'll be talking about writing a script that looks at the distance of your object to the shards, as well as their velocity and their distance to other shards. In other words, when your "breaking" object hits the shards nearest to it, they become dynamic, and the script looks at the velocity of those newly dynamic shards and if their velocity is over a certain threshold, shards nearest them become dynamic, so on and so forth until all objects that meet the conditions are dynamic.

Shaun

tint
Posts: 2
Joined: Sun Mar 28, 2010 5:02 pm

Attach fixed constraints to all objects

Postby tint » Mon Mar 29, 2010 1:24 pm

ah ok, but I will still need the quarter of a million constraints to make this work in realflow?

I dont really understand why every piece needs to be constrained to every other piece. Would it not be enough to constraint to the nearest neighbors?

martin

shaun_michael
Posts: 4766
Joined: Sun Sep 10, 2006 8:04 am

Attach fixed constraints to all objects

Postby shaun_michael » Mon Mar 29, 2010 3:30 pm

If you're scripting it, you don't need constraints at all, the script would do the work for you by setting the dynamics flag when conditions are met.

Shaun


Return to “User Scripts”

Who is online

Users browsing this forum: No registered users and 1 guest