Physics.P2.Body#loadPolygon()

loadPolygon(key, object) → {boolean}

Reads the shape data from a physics data file stored in the Game.Cache and adds it as a polygon to this Body.

As well as reading the data from the Cache you can also pass null as the first argument and a
physics data object as the second. When doing this you must ensure the structure of the object is correct in advance.

For more details see the format of the Lime / Corona Physics Editor export.

Parameters
Name Type Description
key string

The key of the Physics Data file as stored in Game.Cache. Alternatively set to null and pass the
data as the 2nd argument.

object string | object

The key of the object within the Physics data file that you wish to load the shape data from,
or if key is null pass the actual physics data object itself as this parameter.

Returns
boolean -

True on success, else false.

Source code: physics/p2/Body.js (Line 1422)
doc_phaser
2025-01-10 15:47:30
Comments
Leave a Comment

Please login to continue.