Hi. Guys tell me how to correctly calculate the gravity in the level in which the ball (example - http://megaswf.com/serve/1130515). The level of spin (rotate with accelerometer ):
GroundBody->SetAngularVelocity(angle);
then when level was rotate I apply force for my ball
B2Vec2 gravity( -10 * accelY, 10 * accelX);
body->ApplyForce(gravity, body->GetWorldCenter());
Everything works perfect, but if the device krutanut up, the ball flies in up (antigravity). I need to count gravity according to the angle of the world - angle, but the right to do it does not work. May be need work inertia?
I would be very grateful for the help 😉
GroundBody->SetAngularVelocity(angle);
then when level was rotate I apply force for my ball
B2Vec2 gravity( -10 * accelY, 10 * accelX);
body->ApplyForce(gravity, body->GetWorldCenter());
Everything works perfect, but if the device krutanut up, the ball flies in up (antigravity). I need to count gravity according to the angle of the world - angle, but the right to do it does not work. May be need work inertia?
I would be very grateful for the help 😉