new Raycaster( [options])
Parameters:
| Name | Type | Argument | Description | |||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
object |
<optional> |
Raycaster's configuration options. May include:
Properties
|
- Since:
-
- 0.6.0
- Source:
Classes
Members
-
<readonly> version :string
-
Plugin version.
Type:
- string
- Since:
-
- 0.6.0
- Source:
-
debugOptions :Object
-
Raycaster's debug config
Type:
- Object
- Since:
-
- 0.10.0
- Source:
Properties:
Name Type Argument Default Description enableboolean <optional>
false Enable debug mode mapsboolean <optional>
true Enable maps debug graphicsboolean Debug graphics options Properties
Name Type Argument Default Description rayboolean | number <optional>
0x00ff00 Debug ray color. Set false to disable. rayPointboolean | number <optional>
0xff00ff Debug ray point color. Set false to disable. mapPointboolean | number <optional>
0x00ffff debug map point color. Set false to disable. mapSegmentboolean | number <optional>
0x0000ff Debug map segment color. Set false to disable. mapBoundingBoxboolean | number <optional>
0xff0000 Debug map bounding box color. Set false to disable. -
mappedObjects :Array.<object>
-
Array of mapped game objects.
Type:
- Array.<object>
- Since:
-
- 0.6.0
- Source:
-
dynamicMappedObjects :Array.<object>
-
Array of dynamic mapped game objects.
Type:
- Array.<object>
- Since:
-
- 0.10.6
- Source:
-
mapSegmentCount :number
-
Number of segments of circle maps.
Type:
- number
- Since:
-
- 0.6.0
- Default Value:
-
- 0
- Source:
-
<static> Map_dynamic :boolean
-
If set true, map will be automatically updated on scene update event.
Type:
- boolean
- Since:
-
- 0.6.0
- Default Value:
-
- false
- Source:
Methods
-
setOptions( [options])
-
Configure raycaster.
Parameters:
Name Type Argument Description optionsobject <optional>
Raycaster's congfiguration options. May include: Properties
Name Type Argument Default Description scenePhaser.Scene <optional>
Scene in which Raycaster will be used. mapSegmentCountnumber <optional>
0 Number of segments of circle maps. objectsobject | Array.<object> <optional>
Game object or array of game objects to map. boundingBoxPhaser.Geom.Rectangle <optional>
Raycaster's bounding box. debugboolean | object <optional>
Enable debug mode or cofigure debugOptions. - Since:
-
- 0.6.0
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
setBoundingBox(x, y, width, height)
-
Set Raycaster's bounding box.
Parameters:
Name Type Description xnumber The X coordinate of the top left corner of bounding box. ynumber The Y coordinate of the top left corner of bounding box. widthnumber The width of bounding box. heightnumber The height of bounding box. - Since:
-
- 0.6.0
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
mapGameObjects(objects [, dynamic] [, options])
-
Map game objects
Parameters:
Name Type Argument Default Description objectsobject | Array.<object> Game object / matter body or array of game objects / matter bodies to map. dynamicboolean <optional>
false Raycaster.Map dynamic flag (determines map will be updated automatically). optionsobject <optional>
Additional options for Raycaster.Map - Since:
-
- 0.6.0
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
removeMappedObjects(objects)
-
Remove game object's Raycaster.Map maps.
Parameters:
Name Type Description objectsobject | Array.<object> Game object or array of game objects which maps will be removed. - Since:
-
- 0.6.0
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
enableMaps(objects)
-
Enable game object's Raycaster.Map maps.
Parameters:
Name Type Description objectsobject | Array.<object> Game object or array of game objects which maps will be enabled. - Since:
-
- 0.7.2
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
disableMaps(objects)
-
Disable game object's Raycaster.Map maps.
Parameters:
Name Type Description objectsobject | Array.<object> Game object or array of game objects which maps will be disabled. - Since:
-
- 0.7.2
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
update()
-
Updates all Raycaster.Map dynamic maps. Fired on Phaser.Scene update event.
- Since:
-
- 0.6.0
- Source:
Returns:
Raycaster instance- Type
- Raycaster
-
createRay( [options])
-
Create Raycaster.Ray object.
Parameters:
Name Type Argument Description optionsobject <optional>
Ray's congfiguration options. May include: Properties
Name Type Argument Default Description originPhaser.Geom.Point | Point <optional>
{x:0, y:0} Ray's position. anglenumber <optional>
0 Ray's angle in radians. angleDegnumber <optional>
0 Ray's angle in degrees. conenumber <optional>
0 Ray's cone angle in radians. coneDegnumber <optional>
0 Ray's cone angle in degrees. rangenumber <optional>
Phaser.Math.MAX_SAFE_INTEGER Ray's range. collisionRangenumber <optional>
Phaser.Math.MAX_SAFE_INTEGER Ray's maximum collision range of ray's field of view. detectionRangenumber <optional>
Phaser.Math.MAX_SAFE_INTEGER Maximum distance between ray's position and tested objects bounding boxes. ignoreNotIntersectedRaysboolean <optional>
true If set true, ray returns false when it didn't hit anything. Otherwise returns ray's target position. autoSliceboolean <optional>
false If set true, ray will automatically slice intersections into array of triangles and store it in Ray.slicedIntersections. roundboolean <optional>
false If set true, point where ray hit will be rounded. enablePhysicsboolean | 'arcade' | 'matter' <optional>
false Add to ray physics body. Body will be a circle with radius equal to Ray.collisionRange. If set true, arcade physics body will be added. - Since:
-
- 0.6.0
- Source:
Returns:
Raycaster.Ray instance- Type
- Raycaster.Ray
-
getStats()
-
Get raycaster statistics.
- Since:
-
- 0.10.0
- Source:
Returns:
Raycaster statistics.- Type
- object
-
destroy()
-
Destroy object and all mapped objects.
- Since:
-
- 0.10.3
- Source: