Dynamica ( bullet) with fields


#1

Open source plugin dynamica worked with fields.
I’ve found version 2.81, but the fields are not working anymore.
Is there open source dynamica that works with fields, more recent version the better.
I’m not going to use the source code, but I said open source to make difference between that
one and bullet. Bullet works with fields from extension 2014 ( I think).
I’ve used extensively dynamica before but I can’t remember which compiled version it was.
There is thread which maybe explains the question better:
http://forums.cgsociety.org/showthread.php?f=86&t=1046409&highlight=dynamica+fields

Thank you

Als


#2

Hi Als

I’ve done my custom solver based on 2.81 and had no problems whatsoever with fields.

Is there any other information you could give ?

/Risto


#3

Hi Risto,

I haven’t used dynamica for a while.
Which version of maya is this for ?
How do you connect the field to the objects ?
Can you connect them to the arrays as well ?
I’m not going to use the source code, but I said open source to make difference between that
one and bullet. Bullet works with fields from extension 2014 ( I think).
I’ve used extensively dynamica before but I can’t remember which compiled version it was.
There is thread which maybe explains the question better:
http://forums.cgsociety.org/showthr…dynamica+fields

Thanks

Als


#4

I’ve compiled mine for 2013 & 2014 but there shouldn’t be any difference since I’ve left the part of the code that handles maya’s fields intact so if you have 2.81 binaries I can’t see why they shouldn’t just work.

And there’s no connections needed; for example I just tested with a rb and a turbulence and it just worked.

/risto


#5

Hi,
I’ve installed 2.82, fields works now.

Did you manage to bake rigid body arrays?

Thank you !

Als


#6

Glad you got it working.

/Risto


#7

I found the way to bake arreys, with this script. The baking from gui doesn’t work, and it seems this script works only when option bake all (not selected) is on.
// Dynamica Bake
// Bakes Dynamica rigid bodies into new objects, primitives or EasyBaked Hull / Mesh
// Usage: Run script, select options, press Ok, ESC to stop
// Note that simulation view must be visible during sim for bake to work!
// Date: 2009-07-25, Author: “RBD” from Physics Simulation Forum
// Forum: http://www.bulletphysics.com/Bullet/phpBB3/viewforum.php?f=12

Also I wonder when choosing more then one object to create joint rigid body, is it possible to separate them mid simulation into separate bodies ?

Thanks

Als


#8

hmmm…

I don’t have the ‘basic’ - dynamica here but isn’t there somekinda disconnection threshold attribute in the constraint node ?

Check ‘Constraints’ from here : http://www.bulletphysics.org/mediawiki-1.5.8/index.php/Dynamica_user_manual

/Risto


#9

Since I needed quite a bit of objects seemed easier if the above worked, but using constraints is certainly possible way, just more scripting, and I thought much slower.

Thanks

Als


#10

Found some script which copies the array for a frame and it works fine (but no animation):
http://www.bulletphysics.org/Bullet/phpBB3/viewtopic.php?f=12&t=9774

Is there a way to bake arrays animation. Script from above works only on spheres and cubes…

Als


#11

Hi Als.

try this modification:

//This tool instances and connects a set of ordered object(s) at the positions of the bodies in a Dynamica rigid body array
//first select the rigid body array SHAPE,  then select objects that you want instanced at the positions of the bodies 
//in the rigid body array
//
// modified 20.12.2014 Risto Puukko /* connect attributes instead of just move and rotate */ 
//

{
proc string[] bakeRigidBodyArraySnapshot()
{ 
    
    string $sel[] = `ls -sl`;
    
    if (`objectType $sel[0]` != "dRigidBodyArray")
        error "The Dynamica rigid body array SHAPE must be selected first.";
    
    int $bodyCount = `getAttr ( $sel[0] + ".numBodies")`;
    int $variantCount = `size $sel`;
    
    
    if ($variantCount < 2)
        error "Select the rigid body SHAPE first,  then select geometry variants that you want instanced at the positions of the rigid bodies.";
    
    int $i = 1; //skip the rigid body itself
    for (; $i < $variantCount; $i++)
    {
        if (`objectType $sel[$i]` != "transform")
        {
               string $shapeList[] = `listRelatives -path -s $sel[$i]`;
               for($shape in $shapeList)
               {
                  if ( `nodeType $shape` != "mesh" && `nodeType $shape` != "surface")
                        error "Select the rigid body SHAPE first,  then select geometry variants. The objects that followed were not detected to be geometry.";
                        
                }
        }
    }
    
    string $newObjects[];
    
    int $currentVariant = 1;    
    for ($i = 0; $i < $bodyCount; $i++)
    {
        
        string $newObj[] = `instance $sel[$currentVariant]`;
        connectAttr -f ($sel[0] + ".position[" + $i + "]") ($newObj[0] + ".translate"); 
        connectAttr -f ($sel[0] + ".rotation[" + $i + "]") ($newObj[0] + ".rotate"); 
        
        $newObjects[`size $newObjects`] = $newObj[0];
        
        $currentVariant ++;
        if ($currentVariant >= $variantCount)
            $currentVariant = 1; // 0 is the rigidBodyArray

    } 
    
    return $newObjects;   
}

select `bakeRigidBodyArraySnapshot`;
} 

And it works with any geometry you need.
Look at the connections with the connection editor and you’ll get a hang of it :slight_smile:

merry sim’ing from the land of the santa

/Risto