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.
new to bullet physics help
Re: new to bullet physics help
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.
I think you will need to use btRigidBody.proceedToTransform(btTransform). To do your manual rotation.
Re: new to bullet physics help
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.
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.
Re: new to bullet physics help
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
Cheers,
Ola