Class: Map

Raycaster. Map

Map class responsible for mapping game objects.

new Map(options [, raycaster])

Parameters:
Name Type Argument Description
options object Map specific configuration settings.
raycaster Raycaster <optional>
Parent raycaster object.
Since:
  • 0.6.0
Source:

Members


<readonly> type :string

Mapped object's type
Type:
  • string
Since:
  • 0.6.0
Source:

active :boolean

If set true, map will be tested by ray. Otherwise it will be ignored.
Type:
  • boolean
Since:
  • 0.7.2
Default Value:
  • true
Source:

circle :boolean

If set true, map will be treated by ray as circle. Set automaticalyy on map update.
Type:
  • boolean
Since:
  • 0.9.0
Default Value:
  • false
Source:

<readonly> object :object

Reference to mapped object.
Type:
  • object
Since:
  • 0.6.0
Source:

Methods


getPoints( [ray])

Get array of mapped object's vertices used as rays targets.
Parameters:
Name Type Argument Description
ray Raycaster.Ray <optional>
Raycaster.Ray object used in some some types of maps.
Since:
  • 0.6.0
Source:
Returns:
Array of mapped object's vertices.
Type
Array.<Phaser.Geom.Point>

getSegments( [ray])

Get array of mapped object's segments used to test object's intersection with ray.
Parameters:
Name Type Argument Description
ray Raycaster.Ray <optional>
Raycaster.Ray object used in some some types of maps.
Since:
  • 0.6.0
Source:
Returns:
Array of mapped object's segments.
Type
Array.<Phaser.Geom.Line>

getBoundingBox()

Get mapped object's bounding box.
Since:
  • 0.9.0
Source:
Returns:
Mapped object's bounding box.
Type
Phaser.Geom.Rectangle

updateMap()

Update object's map of points and segments.
Since:
  • 0.6.0
Source:
Returns:
Raycaster.Map instance
Type
Raycaster.Map

config( [options])

Configure map.
Parameters:
Name Type Argument Description
options object <optional>
Map's congfiguration options. May include:
Properties
Name Type Argument Default Description
object object Game object to map
type string <optional>
Map type. If not defined, it will be determined based on object.
dynamic boolean <optional>
false If set true, map will be dynamic (updated on scene update event).
active boolean <optional>
true If set true, map will be active (will provide points, segments and will be updated).
segmentCount number <optional>
Circle map's segment count. If set to 0, map won't be generating segments and relay only on tangent points calculated for currently testing ray.
mapChild object <optional>
Container's child. If set, only set child will be mapped.
forceConvex boolean <optional>
If set true, matter body map will use convex body (hull) for non-covex bodies.
forceVerticesMapping boolean <optional>
If set true, matter body map will use only vertices for mapping circle bodies.
Since:
  • 0.6.0
Source:
Returns:
Raycaster.Map instance
Type
Raycaster.Map

setSegmentCount(count)

Set segment count for cirle's map. If set to 0, map won't be generating segments and relay only on tangent points calculated for currently testing ray.
Parameters:
Name Type Description
count number Circle map's segment count.
Since:
  • 0.6.0
Source:
Returns:
Raycaster.Map instance
Type
Raycaster.Map

setCollisionTiles( [tiles])

Set tile types which should be mapped (for Phaser.Tilemaps.StaticTilemapLayer and Phaser.Tilemaps.DynamicTilemapLayer maps only).
Parameters:
Name Type Argument Default Description
tiles array <optional>
[] Set of tile's indexes to map.
Since:
  • 0.7.3
Source:
Returns:
Raycaster.Map instance
Type
Raycaster.Map