hi. new user here with a Q

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
stooch
Posts: 7
Joined: Thu Oct 29, 2009 11:08 pm

hi. new user here with a Q

Post by stooch »

Is there an SDK for the plugin side of this librarY? like all the commands i can use in maya with python, mel, etc?

i found some issues with the current plugin that make it unusable so im writing a production toolset, I fixed the object level transforms, created world constraints, integrated with voronoi shatter, and still need to handle dynamic switching from passive to active state.

also, is there a way to make a "sleeping" hardbody become active upon collision>? like an: "isColliding" flag for passive/active bodies - would be nice so that i can dynamically wake up pieces in a chain reaction type effect and at the same time turn off the constraints, im having to constrain my debris in world space since the maya plugin seems to be only written for world coordinates.

thanks.
stooch
Posts: 7
Joined: Thu Oct 29, 2009 11:08 pm

Re: hi. new user here with a Q

Post by stooch »

anyone? id really like to get this figured out, unless there is a better way to activate rbs on collision.. or create a cluster of RBS that breaks up on impacts.
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: hi. new user here with a Q

Post by RBD »

Well all of the source code for the plugin (and Bullet) is available... see Extras > MayaPlugin under the source code; you should be able to find what you want from the plugin *Cmd and *Node sources.

The Bullet Physics engine itself offers what you are asking for (sleeping, compound rigid bodies) and a lot more, but unfortunately these features are not exposed by the Dynamica plugin... yet; you would need to address that at the C++ plugin level to expand/expose additional Bullet features to Maya. Volunteers are always welcomed.
stooch
Posts: 7
Joined: Thu Oct 29, 2009 11:08 pm

Re: hi. new user here with a Q

Post by stooch »

RBD wrote:Well all of the source code for the plugin (and Bullet) is available... see Extras > MayaPlugin under the source code; you should be able to find what you want from the plugin *Cmd and *Node sources.

The Bullet Physics engine itself offers what you are asking for (sleeping, compound rigid bodies) and a lot more, but unfortunately these features are not exposed by the Dynamica plugin... yet; you would need to address that at the C++ plugin level to expand/expose additional Bullet features to Maya. Volunteers are always welcomed.
thanks for the reply! i was beginning to lose hope lol.

im cracking into the plugin code, i have some bugs to kill :)

speaking of bugs, im not sure if this is intentional, but it seems that the plugin resets all RB positions EXACTLY on the simulation start frame, while the desired behavior is to reset all rigid bodies when currentTime is <= rbSolver start time.

is there some kind of workflow im simply ignorant of here? currently im resetting RBs using some of my own python scrips, but i would imagine that if it was built into the plugin it would be more efficient... so is this a bug or feature?
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: hi. new user here with a Q

Post by RBD »

stooch wrote:[...]it seems that the plugin resets all RB positions EXACTLY on the simulation start frame, while the desired behavior is to reset all rigid bodies when currentTime is <= rbSolver start time.[...]
I don't know? I assume you're referring to this line in dSolverNode.cpp (dSolverNode::computeRigidBodies):

Code: Select all

    if(time == startTime) {
        //first frame, init the simulation
I'm guessing the idea for the dSolver Start Time was simply to allow people to change it to match the playback range's start frame. I assume in your case you're using the start time as a way to delay the simulation start? Then I can see <= instead would make more sense. There doesn't appear to be anyone actively working on the Maya plugin at this time. I think you could recommend fixes in the forum, Erwin or one of the active team members could apply them if they've been properly tested.
stooch
Posts: 7
Joined: Thu Oct 29, 2009 11:08 pm

Re: hi. new user here with a Q

Post by stooch »

yeah thats exactly what im talking about, basically thats the behavior that i expect based on using all other solvers in maya
thanks for pointing out where i could find it, im still reading through the plugin code but ill definitelly share any findings as i work on integrating this into our pipeline.
stooch
Posts: 7
Joined: Thu Oct 29, 2009 11:08 pm

Re: hi. new user here with a Q

Post by stooch »

ok so after more study, it appears that setting it to <= would be a bad idea since then the plugin will reinitialize the hard bodies every frame that is less than the plugin start time.

the better solution is to use this class:

MTime MAnimControl::animationStartTime

if: MTime MAnimControl::animationStartTime == current time, perform a hard body init.

that way hard bodies will initialize every time the playhead restarts OR hits the start frame setting on the dynamic solver.

but wont keep reinitializing the solver for 100 frames if your solver is set to start at frame 100.

are there any favorite compilers or IDEs that are being used for this project? id like to try my hand at compiling this..

also a little bit more comments on the code would be much appreciated, for example, id love to have an overview of what each module does, currently its taking alot of hunting on my end to piece all this together.
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: hi. new user here with a Q

Post by RBD »

stooch wrote:[...]are there any favorite compilers or IDEs that are being used for this project? id like to try my hand at compiling this..

also a little bit more comments on the code would be much appreciated, for example, id love to have an overview of what each module does, currently its taking alot of hunting on my end to piece all this together.
For Linux, just look at the makefile and ensure proper env. variable assignments.
For Windows, there is a Microsoft Visual Studio (2005 or later) solution file (BulletMayaPlugin.sln).

A bit of background, as I understand it: The plugin was written by Nicola Candussi under Disney; he applied some quick fixes and enhancements to it soon after they released it to open source late 2008. Disney released it to open source because they didn't have the resources to fully realize the project, hoping the open source community could pick it up and run with it. Last spring Herbert Law worked on trying to fix / add constraints support (I'm guessing just before leaving Sony for Palm). And now it appears Erwin (Bullet creator and lead) has assigned Roman Ponomarev (Sony, I think) to hopefully work on the plugin, but it seems he's been busy (for Bullet anyhow) working on the OpenCL branch.

So, right now, I don't think there is an expert resource available for the plugin (to add comments or offer guidance and such). I've been wanting to dive into the source myself... but... {insert any number of excuses here}. From the little I glanced at it seems there might be a thin "physics engine abstraction layer" in the plugin since it was originally meant to support multiple physics engines (but I'm not sure since I didn't really look into it).

Note that the source code for the Nima PhysX for Maya plugin is also available for reference. It could provide ideas (like perhaps to handle compounded physics shapes in Maya, or convex mesh reduction/simplification? edit: there's also Bullet Demo ConvexDecompositionDemo available).