The following is a "newbie" question. I have limited experience with the bullet library so far. I am trying to implement this coin pusher prototype game and I've hit a snag.
The mechanical pusher is modelled as a btBoxShape in Bullet - I plan to move it along a predetermined path in a forward-backward motion, such that it pushes coins towards the player. Also coins that fall on top of the pusher are supposed to be moving with the pusher due to surface friction.
My first approach was to simply constantly set the position of the pusher within the physics loop using
Code: Select all
btTransform trans;
trans.setIdentity();
trans.setOrigin(pos); // <-- pos is a btVector3 containing the current x,y,z coordinates of the pusher
psh->setWorldTransform(trans)
Another problem with this approach is (assuming that it worked) that the pusher would instantly change its location and any coin resting on top of it would stay at its place, rather than move along due to friction.
So how would I do this properly? If I give the pusher a mass and exert a force on the pusher, it might start to rotate when some coins bounce into it. Also if I tried to move the pusher forward and backward by applying a force or impulse to it, it will move but not necessarily in a very controlled way. I need it to follow a pretty precise sinusoidal motion along one coordinate axis. Much like a moving platform in a jump and run game.
BTW, The technical details about my physics assumptions are summarized in this thread - it also contains some unanswered questions. http://www.bulletphysics.org/Bullet/php ... &f=&t=3623
I am starting to believe that axis aligned bounding boxes are pretty inefficient with thin coins. They produce too many candidates during the broad phase collision detection. The simulation grinds to a halt at less than 100 coins. I might have to roll my own code here.
Christian