Physics Simulation Forum

 

All times are UTC




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Mar 05, 2009 1:22 pm 
Offline

Joined: Thu Mar 05, 2009 12:37 pm
Posts: 5
We tried to build complex objects composed of small boxes (cube) like lego. The objects could be composed randomly. So we tried to use a compound object but the simulation it is not very stable and realist event with few boxes (125 boxes whose composed a big cube (5x5x5)).

Our questions are :
1- In a first time, we want to know why the following code doesn't work ?
2- In a second time... Is it the good way to do that if you want to have a object composed of 100000 boxes ? We don't need to have a complex collision detection, the only thing we want to know is if the balance object is stable or not.

Here an example of objects we want to build.
http://farm4.static.flickr.com/3083/2627011589_eda3c47fa8.jpg?v=1216068497


Attachments:
BasicDemoOrg.zip [2.19 KiB]
Downloaded 76 times
Top
 Profile  
 
PostPosted: Thu Mar 05, 2009 7:47 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3746
Location: California, USA
Quote:
1- In a first time, we want to know why the following code doesn't work ?

Interesting. You need to shift the child shapes, so that the world transform of the rigid body is aligned with the center of mass/principal axis of inertia.

There is a utility function in btCompoundShape to do this. Once you have this principal transform, there a 3 methods to shift the children:

1) create a recursive compound, with the inverse principal transform
2) shift the transform for each child in-place
3) create a new compound with the updated transform

See attached file, implementing all 3 methods. (3) is fastest to build and performs better then a recursive btCompoundShape.
Quote:
2- In a second time... Is it the good way to do that if you want to have a object composed of 100000 boxes ?

Should theoretically be possible. I just tried 5000 boxes, and the drawing becomes the bottleneck in the basic demo, so you need a better renderer.

Do you have any nice model you can share?
Thanks,
Erwin


Attachments:
BasicDemoCompound.zip [3.82 KiB]
Downloaded 146 times
Top
 Profile  
 
PostPosted: Fri Mar 06, 2009 3:17 am 
Offline

Joined: Thu Mar 05, 2009 12:37 pm
Posts: 5
The program will be open source. We will post results when we will generate nice models.


Top
 Profile  
 
PostPosted: Mon Mar 09, 2009 6:37 pm 
Offline

Joined: Thu Mar 05, 2009 12:37 pm
Posts: 5
Erwin Coumans wrote:
Quote:
1- In a first time, we want to know why the following code doesn't work ?

Interesting. You need to shift the child shapes, so that the world transform of the rigid body is aligned with the center of mass/principal axis of inertia.

There is a utility function in btCompoundShape to do this. Once you have this principal transform, there a 3 methods to shift the children:

1) create a recursive compound, with the inverse principal transform
2) shift the transform for each child in-place
3) create a new compound with the updated transform

See attached file, implementing all 3 methods. (3) is fastest to build and performs better then a recursive btCompoundShape.
Quote:
2- In a second time... Is it the good way to do that if you want to have a object composed of 100000 boxes ?

Should theoretically be possible. I just tried 5000 boxes, and the drawing becomes the bottleneck in the basic demo, so you need a better renderer.

Do you have any nice model you can share?
Thanks,
Erwin


Your code work fine with c++ but some students want to do it with jBullet and it looks like all the functionalities are not present in JBullet for the matrix.

Do you think there is another simpler way to do it ? Only the balance of the objects are important for us ?


Top
 Profile  
 
PostPosted: Mon Mar 09, 2009 9:23 pm 
Offline
Site Admin
User avatar

Joined: Sun Jun 26, 2005 6:43 pm
Posts: 3746
Location: California, USA
Nicolas wrote:
Your code work fine with c++ but some students want to do it with jBullet and it looks like all the functionalities are not present in JBullet for the matrix.

Do you think there is another simpler way to do it ? Only the balance of the objects are important for us ?


The C++ solution BasicDemoCompound.zip attached earlier is the simplest and fastest way that I know.

JBullet is probably out-of-date, so it is best that those students switch over to using the C++ version, or port over the missing parts using the C++ version. For anything Java/JBullet related, contact information is on this website: http://jbullet.advel.cz/

Hope this helps,
Erwin


Top
 Profile  
 
PostPosted: Mon Mar 09, 2009 9:28 pm 
Offline

Joined: Thu Mar 05, 2009 12:37 pm
Posts: 5
Yes, I contacted the author of jbullet. I think we will find the problem.
I will let you know when we have some results.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group