I see the newest releases of Box2D have the ability to have body by body gravity settings, but in the version used for the current flash release, I see that applying an opposite and equal force is the solution.
I have a platform with a ball sitting on top of it. My goal is that the user can move the right and left platform supports up and down, tilting the platform (or raising it, or lowering it) and the ball rolls across its surface as gravity dictates.
The setup for the platform bodies is:
left platform support -- revolute joint -- platform surface -- prismatic joint -- interim body -- revolute joint -- right platform support.
It works great when gravity is 0, but when I put it to 9.81, the platform and the ball on top both drop, as expected. Since the mass of the ball will move, and at various angles the left and right support will be bearing different weights, I don't see a way to apply forces to the supports and bar individually. I'm admittedly newer to physics simulation and Box2D specifically, but didn't see an obvious way to apply a force to the center of mass of a GROUP of bodies, but would appreciate any suggestions as I suspect I'm missing something obvious here.
Thanks already for the help.
I have a platform with a ball sitting on top of it. My goal is that the user can move the right and left platform supports up and down, tilting the platform (or raising it, or lowering it) and the ball rolls across its surface as gravity dictates.
The setup for the platform bodies is:
left platform support -- revolute joint -- platform surface -- prismatic joint -- interim body -- revolute joint -- right platform support.
It works great when gravity is 0, but when I put it to 9.81, the platform and the ball on top both drop, as expected. Since the mass of the ball will move, and at various angles the left and right support will be bearing different weights, I don't see a way to apply forces to the supports and bar individually. I'm admittedly newer to physics simulation and Box2D specifically, but didn't see an obvious way to apply a force to the center of mass of a GROUP of bodies, but would appreciate any suggestions as I suspect I'm missing something obvious here.
Thanks already for the help.