Skip to main content

Tracker

Water state for tagged instances (OceanFloat, OceanTrack) and every player character, updated each frame on whichever side you ask from. The transitions fire the signals on [Ocean]: EnteredWater, ExitedWater, WentUnderWater, WentAboveWater. Inside an OceanDry region nothing counts as water.

Functions​

GetState​

Tracker.GetState(instance: Instance) → State?

Types

​

interface State {
Touching: boolean--

its bottom is below the surface

Under: boolean--

its top is below the surface

Depth: number--

studs below the surface (negative above)

Surface: number--

world Y of the surface there

}

The state of a tracked instance, or nil.

GetInWater​

Tracker.GetInWater() → {Instance}

Every tracked instance touching the water.

Show raw api
{
    "functions": [
        {
            "name": "GetState",
            "desc": "The state of a tracked instance, or nil.",
            "params": [
                {
                    "name": "instance",
                    "desc": "",
                    "lua_type": "Instance"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "State?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 145,
                "path": "src/Ocean/Tracker.luau"
            }
        },
        {
            "name": "GetInWater",
            "desc": "Every tracked instance touching the water.",
            "params": [],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ Instance }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 154,
                "path": "src/Ocean/Tracker.luau"
            }
        },
        {
            "name": "Init",
            "desc": "",
            "params": [],
            "returns": [],
            "function_type": "static",
            "private": true,
            "source": {
                "line": 168,
                "path": "src/Ocean/Tracker.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "State",
            "desc": "",
            "fields": [
                {
                    "name": "Touching",
                    "lua_type": "boolean",
                    "desc": "its bottom is below the surface"
                },
                {
                    "name": "Under",
                    "lua_type": "boolean",
                    "desc": "its top is below the surface"
                },
                {
                    "name": "Depth",
                    "lua_type": "number",
                    "desc": "studs below the surface (negative above)"
                },
                {
                    "name": "Surface",
                    "lua_type": "number",
                    "desc": "world Y of the surface there"
                }
            ],
            "source": {
                "line": 41,
                "path": "src/Ocean/Tracker.luau"
            }
        }
    ],
    "name": "Tracker",
    "desc": "Water state for tagged instances (`OceanFloat`, `OceanTrack`) and every player character, updated\neach frame on whichever side you ask from. The transitions fire the signals on [Ocean]:\n`EnteredWater`, `ExitedWater`, `WentUnderWater`, `WentAboveWater`. Inside an `OceanDry` region\nnothing counts as water.",
    "source": {
        "line": 33,
        "path": "src/Ocean/Tracker.luau"
    }
}