getRayFromCoordinate
Returns a Ray we shoot from the current camera, through pixel on canvas.
getRayFromCoordinate(
x: number,
y: number,
): Promise<Ray>
Parameters
Description
Type
x
x
coordinate in canvas, where 0
is left, and 1
is right.
number
y
y
coordinate in canvas, where 0
is top and 1
is bottom.
number
Usage:
await modelApi.getRayFromCoordinate(0.5, 0.5); // Center of canvas
Return value:
{
"start": {
"x": 426.70406480133295,
"y": -1117.188191256327,
"z": 840.8804717098991
},
"direction": {
"x": -0.33227362438885555,
"y": 0.8507690937811196,
"z": -0.4071685002579967
}
}
Last updated