# Disney's Dynamica plugin for Bullet Physics

#269

Kind of a late reply, but for anyone who is interested in keyframing Mass on a Bullet rigid body, here’s how you do it:

First off, the only difference between passive and active rigidbodies in Bullet is passive rigidbodies have 0 mass. Now the way Bullet handles changing states is a lot like physx, so it’s a little annoying. Let’s start with an example:

// What we would like to happen
frame 1: Cube starts off passive
frame 30: Cube wakes up and starts falling

Simple enough right? Yeah . . . nope. This is what you have to do:

On frame 1 everything needs to be “initialized”, in other words everything needs to be set to active (aka Mass > 0). THEN on frame 2, set whatever you want to be passive to be passive (Mass = 0). Then the frame BEFORE you want stuff to be active, put another passive keyframe on it, followed by an active keyframe (Mass > 0) on the frame you want stuff active.

This is annoying because it leads to a 1 frame lag on your stuff, but can be easily worked around. So our example will now look like this:

// What actually has to happen
frame 1: Keyframe Mass of all the rigidbodies to 1
frame 2: Keyframe Mass of all rigidbodies you want to start passive to 0
frame 30: Keyframe Mass to 0 again
frame 31: Keyframe Mass to 1

Hope this helps.

#270

Or you could just use the script in the previous post.

Another trick is to modify a line in the source code which will enable it to easier keyframe the mass. Then you can just keyframe it to 0 on first and 1 when you want it to start.

#271

Lol, you COULD, but for anyone interested int what is actually going on, thats how you do it

#272

Hmmm, have you done this already Erik? I’d be interested to know what line that is . . .

#273

It is line 518 in dSolverNode.cpp

``````
if(mass >= 0.f)

``````

If changed to that also 0 mass objects are initialized. I have not noticed any big performance loss.

#274

Hey ppl…I have been happily using dynamica for a few days and now I wanted to incorporate some particles into my tests. I have been searching here and on the bullet forum but have not found any posts about accessing attributes of each collision shape such as collision contact points and velocity. Are these available with dynamica?

#275

As far as I know, Nope. I would love to be proven wrong though, because that would be a helpful feature.

#276

wow…I sure hope someone does prove you wrong That information is pretty essential in my opinion and should be standard.

#277

I know right?!? :-\ Hopefully someone can do a serious overhaul on the plugin and add some of the basic functionality that it’s missing.

#278

That feature is must.

This is first thing that should be done in new version.

#279

I just downloaded the source. I’m trying to understand the whole structure first then I’ll run some tests to see if I can get some data out of each rigid object. Hopefully I can make a contribution in this area.

#280

Alright…can somebody help me understand the source. I’m having a bit of trouble connecting the dots.

CollisionShapeNode.h/cpp: Copies all mesh info (vertex, normals etc) on the users geometry and creates a new m_collision_shape = solver_t::create_mesh_shape(&(vertices[0]), vertices.size(), &(normals[0]), &(indices[0]), indices.size());

RigidBodyNode.h/cpp: Does this just setup the drawing properties on m_collision_shape to actually be drawn by dSolverNode?

I cant seem to find the place where the rigid bodies are being processed and where the resulting data is being placed…perhaps someone can explain solver, dSolverNode, bt_Solver and solver_impl. Just wish people would add a good description of the class. Trying to follow the call stack is just too complicated.

Anyone care to give me a tour on the poorly documented source?

#281

can anyone compile bullet for maya 2012 64 bit ?

#282

In the latest version of Dynamica you can keyframe mass, and switching between 0 and non-zero will work.

about accessing attributes of each collision shape such as collision contact points and velocity.

This one is a feature request in the Dynamica issue tracker (http://code.google.com/p/dynamica/issues/detail?id=13), please ‘star’ it if you are interested. I try to fix that soon.

I re-uploaded new source code and precompiled Dynamica builds for Maya 2012 and 2011 for Windows, Linux and Mac OSX 64bit:

The latest Dynamica version simulates deterministic (reproducable outcome when you reset the time slider each time). Also there is basic support for multiple convex shapes, grouped together in a composite/compound single rigid body.

#283

Is there a way to unlink specific fields from the Dynamica simulation? (Didn’t find any info on this in the docs/forum.)

#284

This is currently not possible as far as I know , but a good suggestion.

Do you mind filing a feature request in the issue tracker of http://dynamica.googlecode.com?

#285

Thank you for compiling to Maya 2012 in OSX ! I really appreciated!

#286

We are looking into this. Alternatively, you can try the workflow described here:

http://mbakr.squarespace.com/blog/particle-emission-from-intersected-surfaces.html

#287

We added basic contact attributes in the latest trunk version of Dynamica now, with a sample scene how to access the attribute (note that you need to enable the feature in the solver).