new to bullet physics help

Post Reply
digi123
Posts: 5
Joined: Mon Mar 02, 2009 7:17 am

new to bullet physics help

Post by digi123 »

Hi,

I'm new to physics and bullet physics programming. I'm trying to create a ball/sphere that rolls around a flat box. I want to allow the user to control the flat box as to control the rolling of the ball. e.g. the user tilts box right so that the ball rolls right.

How should I setup the box to allow user interaction? Do I use joints? Can I update the rigid body rotation manually? I'm not sure what is the proper way to do this.

Any help is very appreciated.

Thanks.
.jayderyu
Posts: 19
Joined: Sat Jan 17, 2009 10:51 am

Re: new to bullet physics help

Post by .jayderyu »

When creating your tiltboard you will need make sure to set it as kinematic. Which means the physics engine will take into account any manual control. So durring your input phase or input update you will rotate your box along it's X & Z(assuming Y is hieght).

I think you will need to use btRigidBody.proceedToTransform(btTransform). To do your manual rotation.
digi123
Posts: 5
Joined: Mon Mar 02, 2009 7:17 am

Re: new to bullet physics help

Post by digi123 »

Cool that works! Thanks.

Now I have another problem.

So I'm tilting the board left and the ball is rolling left, then I tilt the board to the right, the ball would bounce up, come down then roll to the right. I suppose this sort of makes sense, if you rotate the board fast enough, a physical object will be bounce up. Sorta like a catapult.

Is there a way to keep the object stuck to the board, like a heavy metal object?

I tried to increase the mass of the object, but it didn't seem to help much. Setting the gravity to be much large seems to help a little, but the object will fall too fast.

Any help is appreciated.

Thanks.
ola
Posts: 169
Joined: Sun Jan 14, 2007 7:56 pm
Location: Norway
Contact:

Re: new to bullet physics help

Post by ola »

Couldn't you just tilt the gravity vector acting on the ball, instead of tilting the board itself? And tilt the graphical model to make it look right (otherwise it'll look like the camera is standing on the board). I recon the ball would stick to the board most of the time, then.

Cheers,
Ola
Post Reply