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

Post Reply
Zimbarbo
Posts: 14
Joined: Thu Jun 28, 2007 2:26 pm

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

Post 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!
BobStrogg
Posts: 3
Joined: Wed May 23, 2007 3:34 pm
Location: Minnesota
Contact:

Post 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.
Zimbarbo
Posts: 14
Joined: Thu Jun 28, 2007 2:26 pm

Thank you!

Post 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!
Post Reply