screenToWorld
此内容尚不支持你的语言。
screenToWorld(
screenX,screenY,inverseVP,vpX,vpY,vpW,vpH,planeZ?):object
Defined in: ui/util/math.ts:109
Where a screen point lands on the world plane at
Parameters
Section titled “Parameters”screenX
Section titled “screenX”number
screenY
Section titled “screenY”number
inverseVP
Section titled “inverseVP”Float32Array
number
number
number
number
planeZ?
Section titled “planeZ?”number = 0
Returns
Section titled “Returns”object
x:
number
y:
number
planeZ.
Details
Section titled “Details”A screen point is a RAY, not a position. Orthographically the ray’s x/y are constant along its length, which is why taking z = 0 worked and why every 2D caller can keep calling this unchanged. Under a perspective camera they are not constant, and the same call would answer with wherever the near plane happened to be — off by more the further the content sits from z = 0.
So the ray is intersected with the plane, which is one implementation with the orthographic case as its degenerate form rather than two branches that have to agree. `planeZ` defaults to the 2D plane, so a caller that has no depth in mind keeps getting the 2D answer.