PDA

View Full Version : dynamica plugin .. animating passive colliders ?


ranxx
01-11-2011, 10:14 PM
hey all, I'm using the bullet dynamica plugin. Does anybody know if it's possible to have an animated (deforming) mesh as a passive rbd in dynamica ? Using the mb_tools ui I have the deforming mesh selected and create a passive rigid body (mesh type), but the created rigid body shape doesn't animate along with the original (it's stuck on the frame it was created). In the hypergraph the connection looks correct (the shape.message is piped into the collisionShape.inShape) but I guess the collision geometry node isn't expecting animating geometry.

thanks

-ranxx

redpawFX
01-13-2011, 06:37 PM
I've looked at the code for this same issue recently, and you're right,
It does not update its input plug per frame so animated geo seems out for now, I have posted something to the development forum about it hoping to gain a little more info, as I think I can modify it if I know enough about the bullet side. The only thing you could try, which is kind of a hack, is to manually force a dgdirty call to the bullet RBD nodes you want to update.

to see it work you can just do all of them

dgdirty -a;

and it will dirty all plugs in your scene and should update the bullet object to the new mesh deformation, however, this is pretty slow, and even if you only dirty exactly the nodes you want it still may not be stable/workable.

you will have to dirty both of the rbdNodes on the object you want to affect, and if I remmeber correctly you have to do one before the other... so you'll have to test it out.

hope this helps, you're not alone in wanting this feature!
-johnc

ranxx
01-13-2011, 06:47 PM
thank you for your response ! I'm glad to know I wasn't doing something wrong. It seems like a simple enough feature. Thank you for your suggestions, I will try to implement them.

-ranxx

jonandy
01-16-2011, 05:41 AM
Changing the code so that the connection between the source geometry/mesh and the collisionShapeNode is of type MFnGenericAttribute seems to fix the problem.

I have yet to spend much time with the Maya API, but it appears message type connections don't propagate dirtiness (i.e., using a call to attributeAffects() wasn't enough to make the animating shape dirty the collisionShape).

I haven't done any real testing to speak of, but at least the geometry is now updating in the UI.

- Andy

SGIFreak
01-16-2011, 09:40 PM
Maya's rigid body solver is over 12 years old and slow. i hope maya 2012 becomes an update.

ranxx
01-17-2011, 12:56 AM
I did some more work and ran some tests. Unfortunately, there's a little more to it than just getting the collisionShapeNode to update. The underlying Bullet Physics classes need to be updated with the updated mesh. Right now, I have it deleting the passive rigid body and recreating it whenever the mesh changes. I suppose this has some use, but for the most part, it just means the passive body ceases to act like a moving object at all, since the new rigid body sort of has no idea where it's going.

To get it working, I would need to expose the underlying bullet methods for updating the mesh in the Dynamica wrapper classes, and call the appropriate routines. Probably not a huge task (assuming Bullet knows what to do with deforming mesh data -- which is a pretty big assumption), but I think it's more than I have time to take on at the moment. If I come back to it at some point, I'll post an update. But for now, hopefully this will serve as some additional information for anyone else who comes across this post looking to do the same thing.

- Andy

CGTalk Moderation
01-17-2011, 12:56 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.