ServersYour serverFor creatorsForumFAQDocumentationSecurity
Download the launcher
  1. Documentation
  2. Client functions
  3. getBrowserPositionFromScreen

Function

getBrowserPositionFromScreen

ClientMiscellaneousTrilogy Hub only

Turns a screen point (e.g. the cursor) into a pixel of a browser page drawn in the world with dxDrawMaterialLine3D or dxDrawMaterialPrimitive3D. This lets you click on screens and billboards with a browser standing in the world.

Syntax

int, int getBrowserPositionFromScreen(browser material, float screenX, float screenY)

Arguments

materialbrowser
The browser (material) drawn in the world.
screenXfloat
Screen X.
screenYfloat
Screen Y.

Returns

The page pixel (x, y) or false.

Example

addEventHandler("onClientRender", root, function()
    local ax, ay = getCursorPositionAbsolute()
    if not ax then return end
    local px, py = getBrowserPositionFromScreen(billboard, ax, ay)
    if px then injectBrowserMouseMove(billboard, px, py) end
end)

Notes

One function. You do not have to work out yourself which pixel the cursor hits; this function does it.

See also