Dynamica Bullet for Maya Issues & Wish List

Physics APIs, Physics file formats, Maya, Max, XSI, Cinema 4D, Lightwave, Blender, thinkingParticles™ and other simulation tools, exporters and importers
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Dynamica Bullet for Maya Issues & Wish List

Post by RBD »

I'm starting this thread just for ideas... no pressure. :)
Feel free to add / expand by adding your bugs / issues / wishes...

Some things I've noticed so far:
  • rigid bodies don't appear to work in world space, only local space (or local space is treated as world space). If rigid bodies are grouped, and the parent moved, they are not aware of it. Grouping of different shapes of rigid bodies together would be very useful, so that they can be moved together and positioned.
  • Mare than 4K (4096) rigid bodies crashes Maya. (ex: one plane = ground + Rigid Body Array with 16x16x16 objects = 4097 rigid bodies = crash on my system)
  • Saving scenes that have not been rewinded with rigid bodies tend to get messed (when re-opened).
Last edited by RBD on Mon Sep 22, 2008 4:39 pm, edited 2 times in total.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Dynamica Bullet for Maya Issues & Wish List

Post by Erwin Coumans »

RBD wrote:
  • rigid bodies don't appear to work in world space, only local space (or local space is treated as world space). If rigid bodies are grouped, and the parent moved, they are not aware of it. Grouping of different shapes of rigid bodies together would be very useful, so that they can be moved together and positioned.
Rigid bodies simulation controls the world transform. A dynamic/active rigid body cannot be a child of another object, because it would become ambiguous who would be responsible for its world transform: the rigid body simulation or another system? If you want to group more than one object, it should become a single rigid body with (multiple) compound collision shapes. Is that what you want?
RBD wrote: [*]Over 4K rigid bodies crashes Maya.
[*]Saving scenes that have not been rewinded with rigid bodies tend to get messed (when re-opened).[/list]
This should be tested and resolved.

Thanks for the feedback,
Erwin
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: Dynamica Bullet for Maya Issues & Wish List

Post by RBD »

Erwin Coumans wrote:Rigid bodies simulation controls the world transform. A dynamic/active rigid body cannot be a child of another object, because it would become ambiguous who would be responsible for its world transform: the rigid body simulation or another system? If you want to group more than one object, it should become a single rigid body with (multiple) compound collision shapes. Is that what you want?[...]
I'll give you an example: let's say you build a structure, like a collapsible building, or let's say an object shatter (an object broken into a bunch of pieces, each one a rigid body), out of a bunch of different rigid bodies, then you could very well need to move this structure / composite object, together as a whole, to another location in your scene for staging.

This should not be a Bullet concern at all, just the way Dynamica gets and sets object pos/rot from Maya world space to Bullet. I believe Maya's API allows to get and set object positions / orientations relative to world space (using MSpace::kWorld) regardless of parents; I think it transparently traverses the entire Maya tree (up through all of the parents) to enable you to retrieve and set an object's position relative to world space (rather than local). I'm only familiar with Maya's API from scripting with Python, but I'll try and have a look at the Dynamica source code. But the PhysX plugin does allow active/passive rigid bodies to be grouped together and moved around (as well as compound rigid bodies/shapes as you describe, which would be handy as well BTW :D ), and I believe PhysX does this on the local transform simply with Maya's API MPxTransform::checkAndSetTranslation/Rotation using the MSpace::kWorld space.
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: Dynamica Bullet for Maya Issues & Wish List

Post by RBD »

Quick little code change request for a little cosmetic thing I noticed, no rush: Dynamica box primitives have gaps between them when touching. Ex.: If you create a Box array: 4x4x4 with 1x1x1 spacing, and deposit it on the ground, zoom in, and there is a permanent gap between all of the boxes. And a 1x1x1 Dynamica Box primitive is smaller than a 1x1x1 Maya unit cube.

Looks like fix only requires two tiny changes in bt_box_shape.h:
line 36: btVector3 const& e = box_shape->getHalfExtentsWithoutMargin();
to: btVector3 const& e = box_shape->getHalfExtentsWithMargin();
and
line 79: btVector3 e = 2 * box_shape->getHalfExtentsWithoutMargin();
to: btVector3 e = 2 * box_shape->getHalfExtentsWithMargin();

Tried it, and it appears to work.
Thanks.
Last edited by RBD on Tue Sep 23, 2008 2:32 pm, edited 2 times in total.
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: Dynamica Bullet for Maya Issues & Wish List

Post by RBD »

Very Nice! It looks like Nicola has fixed the rotation issue... Fantastic! :D

It's working well, but I'm having a little difficulty figuring something out. If I cut up an object, and turn the pieces into rigid bodies, they behave strangely, like the center of gravity is off? I've tried deleting the history, centering the pivots, freezing transformations and a few other things to the pieces, but it persists... I'm sure there is something I can do to the object pieces, I'll try to figure it out tommorow. But here is a little quick example script:

Code: Select all

{
string $pCyl[] = `polyCylinder -r 5 -h 20`;
move -y 10;
string $pObj = $pCyl[0];
float $bb[] = `polyEvaluate -boundingBox ($pObj)`;
int $i;
for ($i = 0; $i < 4; $i++) {
    float $px = rand(($bb[0]*0.95),($bb[1]*0.95));
    float $py = rand(($bb[2]*0.95),($bb[3]*0.95));
    float $pz = rand(($bb[4]*0.95),($bb[5]*0.95));
    float $rx = rand(0,180);
    float $ry = rand(0,180);
    float $rz = rand(0,180);
    polyCut -pc ($px) ($py) ($pz) -ro ($rx) ($ry) ($rz) -ef 1 -eo 0 0 0 ($pObj);
    polyCloseBorder ($pObj);
}
select -r ($pObj);
polySeparate ($pObj);
}
When I turn the resulting pieces into rigid bodies (script cuts up convex pieces, so they're hulls), with the rotation fixes, it appears to work. But when I play the simulation the pieces behave like their center of gravity is far away. Again, I'll try to figure it out tommorow.

Thanks Nicola!

EDIT: Ok, looks like I figured it out... center of gravity is at world space 0,0,0, so I need to center pivots to both object pieces and world space... ok, I can work with that. Some tests, scripts and more later...
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Dynamica Bullet for Maya Issues & Wish List

Post by Erwin Coumans »

Hi RBD,

It looks like you have some good feedback and fixes, we'll look into them.

If you have time, can you investigate further what is needed to support this 'MSpace::kWorld' feature? A patch for that would be welcome (unless Nicola already fixed it). There is still some occasional 'refresh' problem for some of the first objects, when creating a hull/mesh -> it places it at the world origin.

Thanks,
Erwin
RBD
Posts: 141
Joined: Tue Sep 16, 2008 11:31 am

Re: Dynamica Bullet for Maya Issues & Wish List

Post by RBD »

Hi Erwin. I started looking at the plugin code, and am trying to wrap my head around it, I think the physics engine abstraction layer is confusing me a little, but I'll get around to it... I think :? . I tried something quickly with world space, didn't quite work, was messing up the "initial" settings, so I'll have to get back to it later.

The hull / mesh creation at world origin should be an easy fix in the dynamicaUI.mel script, I've got my own working (with original mesh attachment for easy rendering/baking). I'll look into it, but unfortunatly I can't just right now, really sorry.

EDIT: Hmm.. couldn't say "easy fix" without at least quickly looking at it. Try the attachment... maybe?

(Attachment DELETED... too old now)
Last edited by RBD on Wed Jul 29, 2009 5:49 pm, edited 1 time in total.
bazuka
Posts: 20
Joined: Fri Sep 19, 2008 9:21 am

Re: Dynamica Bullet for Maya Issues & Wish List

Post by bazuka »

I think i found some bugs :)

1st, when u move array group pivot point is acting strange?
2nd, u cant rotate array group
3rd, when u freeze transform array group goes back on the start possition

cheers