Skip to main content

CameraUtil

This item only works when running on the client. Client

Properties

Instance

CameraUtil.Instance: Camera

The current camera instance.

State<CFrame>

CameraUtil.State<CFrame>: CameraCFrame

A State containing the current camera's CFrame.

State<Vector2>

CameraUtil.State<Vector2>: ViewportSize

A State containing the current camera's ViewportSize.

State<number>

CameraUtil.State<number>: ViewportSizeY

A Computed containing the current camera's ViewportSize.Y.

Functions

isOnScreen

CameraUtil.isOnScreen(
worldPointVector3,--

The world position to check.

viewportMarginnumber?--

The acceptable margin of viewport space to be considered on screen. Defaults to 50.

) → (
boolean,--

Whether or not the position is on screen.

number--

The distance the point is from the camera

)

A function that takes a world position and returns whether or not that point is on screen within the camera's viewport.

Show raw api
{
    "functions": [
        {
            "name": "isOnScreen",
            "desc": "A function that takes a world position and returns whether or not that\npoint is on screen within the camera's viewport.",
            "params": [
                {
                    "name": "worldPoint",
                    "desc": "The world position to check.",
                    "lua_type": "Vector3"
                },
                {
                    "name": "viewportMargin",
                    "desc": "The acceptable margin of viewport space to be considered on screen. Defaults to 50.",
                    "lua_type": "number?"
                }
            ],
            "returns": [
                {
                    "desc": "Whether or not the position is on screen.",
                    "lua_type": "boolean"
                },
                {
                    "desc": "The distance the point is from the camera",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 99,
                "path": "src/railutils/src/RailUtil/CameraUtil.lua"
            }
        }
    ],
    "properties": [
        {
            "name": "Instance",
            "desc": "The current camera instance.",
            "lua_type": "Camera",
            "source": {
                "line": 47,
                "path": "src/railutils/src/RailUtil/CameraUtil.lua"
            }
        },
        {
            "name": "State<CFrame>",
            "desc": "A State containing the current camera's CFrame.",
            "lua_type": "CameraCFrame",
            "source": {
                "line": 54,
                "path": "src/railutils/src/RailUtil/CameraUtil.lua"
            }
        },
        {
            "name": "State<Vector2>",
            "desc": "A State containing the current camera's ViewportSize.",
            "lua_type": "ViewportSize",
            "source": {
                "line": 61,
                "path": "src/railutils/src/RailUtil/CameraUtil.lua"
            }
        },
        {
            "name": "State<number>",
            "desc": "A Computed containing the current camera's ViewportSize.Y.",
            "lua_type": "ViewportSizeY",
            "source": {
                "line": 68,
                "path": "src/railutils/src/RailUtil/CameraUtil.lua"
            }
        }
    ],
    "types": [],
    "name": "CameraUtil",
    "desc": "",
    "realm": [
        "Client"
    ],
    "source": {
        "line": 8,
        "path": "src/railutils/src/RailUtil/CameraUtil.lua"
    }
}