Physics.P2#convertCollisionObjects()

convertCollisionObjects(map, layer, addToWorld) → {array}

Converts all of the polylines objects inside a Tiled ObjectGroup into physics bodies that are added to the world.
Note that the polylines must be created in such a way that they can withstand polygon decomposition.

Parameters
Name Type Argument Default Description
map Phaser.Tilemap

The Tilemap to get the map data from.

layer number | string | Phaser.TilemapLayer <optional>

The layer to operate on. If not given will default to map.currentLayer.

addToWorld boolean <optional>
true

If true it will automatically add each body to the world.

Returns
array -

An array of the Phaser.Physics.Body objects that have been created.

Source code: physics/p2/World.js (Line 1625)
doc_phaser
2017-02-14 11:00:54
Comments
Leave a Comment

Please login to continue.