So I know you are not supposed to reposition dynamic bodies manually, but I am trying to do something so simple here, I just dont see why I am having problems... I create two rigid bodies (both using a simple box shape), and initialize them with a identity transform. Now, since they are both stacked ontop of each other, when I run my app one of the bodies goes flying off as expected (while the other seems to be frozen in space for some odd reason). Anyway, I know I could just set their initial transforms when I create the bodies, but shouldnt I be able to reposition them both AFTER they have been created (at 0,0,0), but BEFORE I step the simulation for the first time? Do I have no window of time to move things around before I start the simulation?
Well every time I try to reposition the bodies (again, before the simulation is stepped for the first time), the SECOND body repositions just fine, but the first just sits there frozen in space (at 0,0,0). I have tried this with and without a motion state. I have tried using every 'set transform' method I could find, and none of them seem to work...
Code: Select all
body->setWorldTransform(trans);
body->getMotionState()->setWorldTransform(trans);
body->setInterpolationWorldTransform(trans);
body->setWorldTransform(trans);
Is my only option to delete the body, recreate it, then re add it to the simulation (with the new transform). There has to be a better way.. what if you have a lot of high frequency bodies that you want to recycle without having to constantly new/delete them (like rockets or other projectiles)?
Thanks for any help