vanderlin / ofxBox2d

Openframework wrapper for box2d

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

enableGravity is commented out

ofZach opened this issue · comments

this has been commented out

void ofxBox2dBaseShape::enableGravity(bool b) {
//bodyDef.isGravitated = b;
}

potential fix might be:

void ofxBox2dBaseShape::enableGravity(bool b) {
    if (b == false){
        bodyDef.gravityScale = 0.0;
    } else {
        bodyDef.gravityScale = 1.0;
    }
}

The bodyDef is only used before the body is created. This should do it, adding to updates I'm working on.

void ofxBox2dBaseShape::enableGravity(bool b) {
    if (body) {
        body->SetGravityScale(b ? 1 : 0);
    }
    else {
        bodyDef.gravityScale = b ? 1 : 0;
    }
}