I’ve got a little problem with moving my player, when i pressed the button player moves but it seems the gravity doesnt work in this time. Is there any special function for box2d or i have to make collision detection with ground and make button unable to press ?
b2Vec2 gravity;
gravity.Set(0.0f, -9.81f);
this->world = new b2World(gravity);
This is because you are setting linear velocity directly. Because you are setting 0 for y component hero will not be pulled by gravity in a normal way, levitation you see is because you are settings linear velocity after world step and it will take a small amount of gravity into account when calculating positions.
You have to use either forces or impulses or you can just try it like this