C ++ Box2D - Dynamic bodies not affected by gravity if left alone

I played with Box2D in SFML2 and understood; when I change the gravity of the world, dynamic bodies that were unobtrusive for a while are not affected by gravity. I prepared a video to make this explanation clearer.

Any solutions? Should I make my own gravity, and why is this happening?

This Video. Please note that if the bodies do not move for a short time, they are not affected by more recently transferred ones.

+7
source share
1 answer

Objects in Box2D go to sleep after they calm down. After changing parameters, such as gravity, you will have to wake up sleeping objects, probably causing WakeUp for all objects. Objects are also automatically woken up when something collides with it, so gravity seems to take effect after something collides with the object.

+6
source

All Articles