Page 1 of 1

[C# ver] One box falls normally. Two boxes repel?

Posted: Thu Jun 28, 2007 2:33 pm
by Zimbarbo
Hello,
I have set up an extremely simple example trying to learn Bullet. If I add one RigidBody, it slowly falls correctly due to gravity. However, if I add a second static box below it, the first one now start flying up and spinning out of control.

Maybe related, even when I add one, its MotionState.GraphicsWorldTransform is always messed up, and I have to use the RigidBody's WorldTransform. But again, after I add a second rigid body, even it goes nuts.

Would there be any reason adding a second rigid body would cause force onto another without ever touching each other?

Thanks!

Posted: Thu Jun 28, 2007 2:58 pm
by BobStrogg
Zimbarbo - I don't know the specific cause of the problem you're seeing, but it might help to look at some existing C# code that's using BulletX and compare the way it renders (I remember needing to jump through a couple of hoops to get things behaving as expected).

Take a look at the source code here: http://www.chriscavanagh.com/Chris/Sour ... 1_full.zip

There's an associated blog post here: http://chriscavanagh.wordpress.com/2007 ... sics-xbap/

At first, make sure you keep things like mass, restitution etc simple (give everything a mass of 1 and other values 0.5; you can tweak them later if needed).

Hope this helps. Let me know how it goes.

Thank you!

Posted: Fri Jun 29, 2007 2:02 am
by Zimbarbo
That was something that I really needed, and I appreciate it! I have been pouring over the included examples and these boards, and while learning a lot, was still missing some basic things. The first thing I missed was giving 'HalfExtents' to the BoxShape.

HalfExtents means if I wanted a 10x10x10 box, I would give 5x5x5, right?

Another question about your code is registering a collision create func. I am just using boxes, and it seems to work Ok. I see people talking about making new ones, but is this necessary with boxes? Do you know if the default behavior is just for basic boxes perhaps, and that is why there is the sphere special functions, and you used the SphereSphereColAlg?

Thanks again!