Saturday, June 4, 2022
HomeGame Developmentc++ - Box2D make dynamic physique fastened on the y axes

c++ – Box2D make dynamic physique fastened on the y axes


I engaged on a recreation venture utilizing C++ with SMFL and Box2d.
I am mainly recreating the sport “Bounce and Hover”, a easy platform recreation.

Within the recreation ther is an platform thats “hovering” within the air and the participant can transfer it left and proper by collideing with it. The participant can stand on the platform with out make it happening and the participant can hit in from under with out makeing it going up.
So basicly its fastened on the y axes and might solely transfer left/proper.

My first thought of implementing this was to set the rate.y to 0 each spherical in my normal replace operate that being referred to as each step of the world.

Sadly it didnt work. its made the movment up/down very sluggish however didnt stop that.

My second thought was to set the gravity scale of the participant to zero when he hit the platform from above = stands on it. That labored virtually completely however when im jumpging on the platform after couple jumps its goes slightly bit down. Plus it additionally nonetheless goes up when hitting it from under.

Im out of concepts so Im asking for assist.

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments