I'm trying to simulate stacked "Kapla" blocks using box primitives but they start jumping as soon as a few are stacked. Kapla planks have a size ratio of 1:3:15. Is the problem due to the lenght? Will this idea not work? Tried increasing substeps... didn't help.
Here's an example video of the situation (floor is a plane primitive, blocks are box primitives, one stack with blocks sized 1:3:15 units and one stack with blocks 1/2 size of that; tried larger... didn't help) using MayaPlugin built from Bullet rev 1765 (also tried 1751):
Kapla Unstable
Thanks.
Unstable "Kapla" Box Primitives (Dynamica Problem)
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Unstable "Kapla" Box Primitives (Dynamica Problem)
Last edited by RBD on Fri Sep 18, 2009 4:51 pm, edited 1 time in total.
-
- Posts: 178
- Joined: Fri Apr 18, 2008 2:20 pm
Re: Unstable "Kapla" Box Primitives
Not sure at all, but have you tried to enable "split impulse" (you need 2.75 for that) ?
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: Unstable "Kapla" Box Primitives
Thanks, but that doesn't appear to help. I can't get these stable unless I stack them at their center of gravity. I guess it is due to the longer they are, the more even small variations in angular momentum will wreak havok.
I'll have to switch to Jenga type blocks, they're more compact and therefore more stable. But still, if I stack'em high (25 or more), then the stack will bob up and down as the forces propagate through it. I wonder if there is any way to eliminate bobing for tall stacks of rigid bodies if real-time performance is not required? (was using fixedTimeStep = 1/120 & maxSubSteps = 1000; tried fixedTimeStep of 1/240 & maxSubSteps 10000, bob becomes a fast vibrate, 25+ stack still not stable).
I'll have to switch to Jenga type blocks, they're more compact and therefore more stable. But still, if I stack'em high (25 or more), then the stack will bob up and down as the forces propagate through it. I wonder if there is any way to eliminate bobing for tall stacks of rigid bodies if real-time performance is not required? (was using fixedTimeStep = 1/120 & maxSubSteps = 1000; tried fixedTimeStep of 1/240 & maxSubSteps 10000, bob becomes a fast vibrate, 25+ stack still not stable).
-
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Unstable "Kapla" Box Primitives
It looks like the collision detection goes wrong in the initial video, are those btBoxShape objects? Are you setting the collision margin to zero?
Can you share the Maya file, attached to this forum as a zip file?
Thanks,
Erwin
Can you share the Maya file, attached to this forum as a zip file?
Thanks,
Erwin
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: Unstable "Kapla" Box Primitives
Yes, shapes are btBoxShape and collision margin appears to be the default. Essentially, I'm using the unchanged source code from r1765, only tried tweaking the Dynamica stepSimulation params later to test.
To avoid problems with different Maya version scene files, I've attached a MEL script. With the Dynamica plugin loaded in Maya, in a New Scene, source the MEL script from the Script Editor. Set your timeline playback range end time high (for real-time playback, right-click the timeline, set Playback Speed to Play every frame, Max Real-time).
Thanks!
To avoid problems with different Maya version scene files, I've attached a MEL script. With the Dynamica plugin loaded in Maya, in a New Scene, source the MEL script from the Script Editor. Set your timeline playback range end time high (for real-time playback, right-click the timeline, set Playback Speed to Play every frame, Max Real-time).
Thanks!
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: Unstable "Kapla" Box Primitives
How did you tweak the stepSimulation?
It is fine to use something like
Does the mel script generate the scene from the movie? If not, please attach a zipped Maya .mb or .ma file.
Thanks,
Erwin
It is fine to use something like
Code: Select all
world->stepSimulation(deltaTime,10,1./240.);
Thanks,
Erwin
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: Unstable "Kapla" Box Primitives
Thanks, I triedErwin Coumans wrote:How did you tweak the stepSimulation?
It is fine to use something likeCode: Select all
world->stepSimulation(deltaTime,10,1./240.);
Code: Select all
m_dynamicsWorld->stepSimulation(dt, 10000, 1.0 / 240.0);
Yes, it's the same structure as in the movie; entire scene in movie was created using this script only, nothing else, except movie shows two structures with different height and Kapal block sizes (configurable in script: $height and $blocksize). I get the same result with one or more structures.Erwin Coumans wrote:Does the mel script generate the scene from the movie?
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: Unstable "Kapla" Box Primitives (MayaPlugin problem?)
Hi Erwin. Worried that this might only be a Dynamica (Maya plugin) problem I tried a quick hack (sorry it's quick and dirty) at BasicDemo.cpp (attached) to test this structure and while I get a structure bounce (and sometimes fall) with a height of 10, it's perfectly solid at a height of 2, unlike in Maya. And if I increase the stepSimulation fixedTimeStep to 1/240 in this BasicDemo, then even with a height of 10 the structure becomes quite solid.
So, even though I get a similar bounce with a tall structure in this BasicDemo it seems that the problem is much worse / exacerbated by the Dynamica Maya Plugin... assuming someone else can confirm the problem in Maya (in case the problem is limited to my machine / compile?). So it does seem to be more a Maya Plugin issue than a general Bullet issue.
Thanks!
So, even though I get a similar bounce with a tall structure in this BasicDemo it seems that the problem is much worse / exacerbated by the Dynamica Maya Plugin... assuming someone else can confirm the problem in Maya (in case the problem is limited to my machine / compile?). So it does seem to be more a Maya Plugin issue than a general Bullet issue.
Thanks!
You do not have the required permissions to view the files attached to this post.
-
- Posts: 141
- Joined: Tue Sep 16, 2008 11:31 am
Re: Unstable "Kapla" Box Primitives (Dynamica Problem)
Hi Erwin, I've been playing outside of Maya with these Kapla type blocks / planks and it's working very well (still don't know what's wrong with the plugin). The simulation has been running surprisingly solidly even for tall layered structures with a timeStep of 1/24 and a fixedTimeStep 1/240. I'm very impressed with the incredible realistic and robust performance of the physics engine, let alone the speed. Here's a couple of renders I did of my tests:
3000 Kapla type planks simulated with Bullet Physics: YouTube - 3000 Kapla planks in slow motion
It does start to get slow with thousands of rigid bodies. I noticed AMD has recently released their OpenCL SDK. Hopefully I can download it and get started playing with this and the OpenCL branch, perhaps it will allow real-time performance with thousands of rigid bodies?
Thanks.
3000 Kapla type planks simulated with Bullet Physics: YouTube - 3000 Kapla planks in slow motion
It does start to get slow with thousands of rigid bodies. I noticed AMD has recently released their OpenCL SDK. Hopefully I can download it and get started playing with this and the OpenCL branch, perhaps it will allow real-time performance with thousands of rigid bodies?
Thanks.