# Physics Simulation Forum

 Page 1 of 1 [ 8 posts ]
 Print view Previous topic | Next topic
Author Message
 Post subject: Dynamica Bullet for Maya Issues & Wish ListPosted: Sun Sep 21, 2008 7:39 pm

Joined: Tue Sep 16, 2008 11:31 am
Posts: 123
I'm starting this thread just for ideas... no pressure.

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.

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Mon Sep 22, 2008 2:20 am

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3822
Location: California, USA
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).

• This should be tested and resolved.

Thanks for the feedback,
Erwin

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Mon Sep 22, 2008 2:45 pm

Joined: Tue Sep 16, 2008 11:31 am
Posts: 123
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 ), and I believe PhysX does this on the local transform simply with Maya's API MPxTransform::checkAndSetTranslation/Rotation using the MSpace::kWorld space.

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Tue Sep 23, 2008 5:05 am

Joined: Tue Sep 16, 2008 11:31 am
Posts: 123
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.

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Tue Sep 23, 2008 5:44 am

Joined: Tue Sep 16, 2008 11:31 am
Posts: 123
Very Nice! It looks like Nicola has fixed the rotation issue... Fantastic!

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:
{
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...

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Wed Sep 24, 2008 6:32 am

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3822
Location: California, USA
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

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Thu Sep 25, 2008 12:54 pm

Joined: Tue Sep 16, 2008 11:31 am
Posts: 123
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.

Top

 Post subject: Re: Dynamica Bullet for Maya Issues & Wish ListPosted: Sat Sep 27, 2008 10:03 am

Joined: Fri Sep 19, 2008 9:21 am
Posts: 20
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

Top

 Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending
 Page 1 of 1 [ 8 posts ]

#### Who is online

Users browsing this forum: No registered users and 1 guest

 You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum

Search for:
 Jump to:  Select a forum ------------------ BULLET PHYSICS LIBRARY USERS    General Bullet Physics Support and Feedback    Release Announcements    Applications, Games, Demos or Movies using Bullet PHYSICS AUTHORING TOOLS, SERIALIZATION AND STANDARDS    Physics authoring tools, serialization, standards and related topics RESEARCH AND DEVELOPMENT IN COLLISION DETECTION & PHYSICS. Don't post Bullet support questions here!    Research and development discussion about Collision Detection and Physics Simulation    Links, Papers, Libraries, Demos, Movies, Comparisons       Non-technical forum and license/patent discussion    Career Opportunities