Skip to content

gravity function not setting gravity, possible fix provided #40

@selticesystems

Description

@selticesystems

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions