API Docs for:
Show:

LS.Picking Class

Defined in: ../src/picking.js:2
Module: LS

Picking is used to detect which element is below one pixel (used the GPU) or using raycast

Constructor

LS.Picking

()

Defined in ../src/picking.js:2

Methods

getInstanceAtCanvasPosition

(
  • x
  • y
  • camera
  • layers
  • scene
)
Object

Returns the instance under a screen position

Parameters:

  • x Number

    in canvas coordinates

  • y Number

    in canvas coordinates

  • camera Camera
  • layers Number

    default is 0xFFFF which is all

  • scene Scene

Returns:

Object:

the info supplied by the picker (usually a SceneNode)

getNextPickingColor

(
  • info
)
Vec3

Returns a color you should use to paint this node during picking rendering you tell what info you want to retrieve associated with this object if it is clicked

Parameters:

  • info

Returns:

Vec3:

array containing all the RenderInstances that collided with the ray

getNodeAtCanvasPosition

(
  • x
  • y
  • camera
  • layers
  • scene
)

Renders the pixel and retrieves the color to detect which object it was, slow but accurate

Parameters:

  • x Number

    in canvas coordinates

  • y Number

    in canvas coordinates

  • camera Camera

    default is all cameras

  • layers Number

    default is 0xFFFF which is all

  • scene Scene

    default is GlobalScene