For example:
m_body_with_custom_gravity->applyForce(CUSTOM_GRAVITY * m_body_with_custom_gravity->getMass())
Where CUSTOM_GRAVITY is a b2Vec2 similar to how the world's inital gravity was set. It's also important to multiply it by the body's mass.
Source: http://stackoverflow.com/questions/7871028/box2d-gravity-to-specific-object
No comments:
Post a Comment