Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gravity function not setting gravity, possible fix provided #40

Open
selticesystems opened this issue Sep 11, 2015 · 0 comments
Open

gravity function not setting gravity, possible fix provided #40

selticesystems opened this issue Sep 11, 2015 · 0 comments

Comments

@selticesystems
Copy link

The problem is with:

gravity: function(value) {
    if (value !== undefined) {              
        this._world.SetGravity(new b2Vec2(value.x, value.y));
    }
    var v = this._world.GetGravity();
    return {x: v.x, y: v.y};
},

I had to change

this._world.SetGravity(new b2Vec2(0, value));

to

this._world.SetGravity(new b2Vec2(value.x, value.y));

It asks for {x,y} but if you send in {x: 0, y: 20} for example, it thinks y is now an object until the above fix is applied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant