I working on a game project using C++ with SMFL and Box2d. I'm basically recreating the game "Jump and Hover", a simple platform game.
In the game ther is an platform thats "hovering" in the air and the player can move it left and right by collideing with it. The player can stand on the platform without make it going down and the player can hit in from below without makeing it going up. So basicly its fixed on the y axes and can only move left/right.
My first idea of implementing this was to set the velocity.y to 0 every round in my general update function that being called every step of the world.
Unfortunately it didnt work. its made the movment up/down very slow but didnt prevent that.
My second idea was to set the gravity scale of the player to zero when he hit the platform from above = stands on it. That worked almost perfectly but when im jumpging on the platform after couple jumps its goes a little bit down. Plus it also still goes up when hitting it from below.
Im out of ideas so Im asking for help.