Page 1 of 1

Model Scaling

Posted: Tue Apr 09, 2019 8:15 am
by shravan tata
Hi All,

I recently read a post about model scaling in bullet on the forum.
But the link they refer to as wiki, here (http://www.bulletphysics.org/mediawiki- ... _The_World) no longer exists.
Could any one point me to the right page about Scaling the World wiki for Bullet. Thank you

Re: Model Scaling

Posted: Tue Apr 09, 2019 9:06 am
by S1L3nCe
Hi,

I don't know when the wiki will be back but you could still access some tutorials with this:
https://web.archive.org/web/20170706235 ... /Main_Page

Yours is in Various Tutorial Articles>Scaling The World :)

Re: Model Scaling

Posted: Tue Apr 09, 2019 12:30 pm
by shravan tata
Hi,

Thank you very much for pointing to the right reference. After reading through the wiki it seems like this was almost 10 years ago and a lot has changed over this time. I am not sure anymore if model scaling is still relevant/necessary in bullet or it is handled much better now?

Thank you

Re: Model Scaling

Posted: Tue Apr 09, 2019 12:47 pm
by S1L3nCe
I'm not very aware on this subject anymore but I think this tutorial is still relevant.

Re: Model Scaling

Posted: Fri Apr 12, 2019 2:47 am
by PcChip
thanks for the updated links, I was just looking for that thing as well

question - will I also have to update my debug drawer to scale all points/lines down by a factor of 10 (or whatever I scale everything by) ?

also how will this work with OpenGL picking by using raycasting from the screen/camera position?

Re: Model Scaling

Posted: Fri Apr 12, 2019 4:10 pm
by S1L3nCe
You will scale values gived to Bullet so you will need to unscale values coming from Bullet to use them.

The fastest way is to use methods like xxx_to_bullet and bulet_to_xxx
With vector3, the first one will take a vector3 used in your project and will generate a btVector3 where the scale factor has been applied.
The second one will do the opposite and generate a vector3 used in your project from a btVector3 by removing the scale factor from it.

RayTest won't change that much, you still need to compute start and end points as before. (take a look at Bullet ExampleBrowser if you don't know how)
But then use xxx_to_bullet to scale those vector3 before using them.

Re: Model Scaling

Posted: Fri Apr 12, 2019 8:57 pm
by PcChip
Thanks for the advice

for the longest time I've been having problems with small items falling through the ground. When dumping lots of small boxes on the ground, about 50% fall through. If I crank the step up from 1/60 to 1/120, about half as many fall through, so it's better, but this really isn't acceptable

So I tried scaling the entire world up by 10x, however still half the boxes fall through :(

I've tried with terrain made from a heightfield, and a btBvhTriangleMeshShape made from btTriangleMesh, and both have this issue

Re: Model Scaling

Posted: Mon Apr 15, 2019 5:26 pm
by drleviathan
Have you enabled continuous collision detection (CCD) on the small moving objects? It definitely helps solve the tunnelling problem but my experience has been: it doesn't fix it completely. To enable CCD you set the radius of the proxy sphere and a minimum motion delta at which to use CCD. For decent results set them to both the same value:

Code: Select all

object->setCcdSweptSphereRadius(boundingRadius);
object->setCcdMotionThreshold(boundingRadius);
To disable CCD for the object set the motion threshold to zero:

Code: Select all

object->setCcdMotionThreshold(0.0);

Re: Model Scaling

Posted: Tue Apr 16, 2019 1:23 am
by PcChip
Thanks for the tip DrLeviathan,

I just tried that, unfortunately it made no difference

Image

I also tried one of Lunkhound's fixes to flip the normals when an object starts falling through the ground:

Image

The problem that I see is that a simple scene with objects dropping onto terrain is one of the first tests a developer that is looking for a physics engine for their game is going to try, and if their first interaction with Bullet is "half the things just fall through the ground", then they're going to pick a different physics engine. I hate saying that because I love Bullet, but...

Re: Model Scaling

Posted: Tue Apr 16, 2019 8:45 pm
by drleviathan
I dunno. The tunnelling problem is a fundamental issue for physics simulations. You need to understand it and tweak your simulation or your content to solve it. I'm sure it is solvable. Answer these questions and maybe someone here will have an idea:

What are the dimensions of your objects? How big are the mesh's triangles and how small are the dynamic objects?
What shape types are you using? What collision margin are you using on your shapes?
What is your substep duration? Are you using fixed substeps or variable?
What are you using for your CCD radius and motionThreshold?

Re: Model Scaling

Posted: Thu Apr 18, 2019 6:49 am
by steven
hi PcChip,
PcChip wrote:
Fri Apr 12, 2019 8:57 pm

So I tried scaling the entire world up by 10x, however still half the boxes fall through :(
this is strange, could you share with me your scene or some code of how do you create your world? thanks.
i want to figure out what happened.

thanks.