Skip to content

P2 Config Seems strange #1412

@englercj

Description

@englercj

this line in the ctor of the P2 World seems wrong:

https://github.com/photonstorm/phaser/blob/master/src/physics/p2/World.js#L27

if (typeof config === 'undefined' || !config.hasOwnProperty('gravity') || !config.hasOwnProperty('broadphase'))
    {
        config = { gravity: [0, 0], broadphase: new p2.SAPBroadphase() };
    }

Seems like that means if I pass in { gravity: [0, -9] } that my gravity will be overridden since I don't pass a broadphase. Is this intentional?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions