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/262 ... 1216068497
Balance of complex object :
-
- Posts: 5
- Joined: Thu Mar 05, 2009 12:37 pm
Balance of complex object :
You do not have the required permissions to view the files attached to this post.
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Balance of complex object :
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.1- In a first time, we want to know why the following code doesn't work ?
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.
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.2- In a second time... Is it the good way to do that if you want to have a object composed of 100000 boxes ?
Do you have any nice model you can share?
Thanks,
Erwin
You do not have the required permissions to view the files attached to this post.
-
- Posts: 5
- Joined: Thu Mar 05, 2009 12:37 pm
Re: Balance of complex object :
The program will be open source. We will post results when we will generate nice models.
-
- Posts: 5
- Joined: Thu Mar 05, 2009 12:37 pm
Re: Balance of complex object :
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.Erwin Coumans wrote: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.1- In a first time, we want to know why the following code doesn't work ?
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.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.2- In a second time... Is it the good way to do that if you want to have a object composed of 100000 boxes ?
Do you have any nice model you can share?
Thanks,
Erwin
Do you think there is another simpler way to do it ? Only the balance of the objects are important for us ?
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Balance of complex object :
The C++ solution BasicDemoCompound.zip attached earlier is the simplest and fastest way that I know.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 ?
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
-
- Posts: 5
- Joined: Thu Mar 05, 2009 12:37 pm
Re: Balance of complex object :
Yes, I contacted the author of jbullet. I think we will find the problem.
I will let you know when we have some results.
I will let you know when we have some results.