I can't figure out why I am getting errors when I attempt to create a b2World in a header file. Apparantly, you can't create a b2World without setting the Gravity. This is essentially what I have :
I get this error :
My reasoning for doing this is so that any part of this class can access my world object. Does anyone know a way to do this?
Code:
b2Vec2 gravity(0.0f, 10.0f);
class Box2D_Component
{
public:
Box2D_Component
private:
b2World world(gravity);
float timestep;
int32 velocityIterations;
int32 positionIterations;
uint32 flags;
}
class Box2D_Component
{
public:
Box2D_Component
private:
b2World world(gravity);
float timestep;
int32 velocityIterations;
int32 positionIterations;
uint32 flags;
}
I get this error :
Quote:
error: 'gravity' does not name a type
My reasoning for doing this is so that any part of this class can access my world object. Does anyone know a way to do this?