Skip to content

Instantly share code, notes, and snippets.

@8Observer8
Created February 8, 2025 20:30
Show Gist options
  • Save 8Observer8/fc07fd01c3de0cd2e2bd2b45a96f98a7 to your computer and use it in GitHub Desktop.
Save 8Observer8/fc07fd01c3de0cd2e2bd2b45a96f98a7 to your computer and use it in GitHub Desktop.
Print gravity with Box2D 2.4.2
#include <box2d/box2d.h>
#include <iostream>
int main()
{
b2Vec2 gravity(0.f, -9.8f);
b2World* world = new b2World(gravity);
float gx = world->GetGravity().x;
float gy = world->GetGravity().y;
std::cout << "gravity = (" << gx << ", " << gy << ")" << std::endl;
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment