Skip to main content

HintScoringUtils

Utility functions that let you score a proximity prompt (i.e. a Hint) based upon its relation to a character in 3D space.

Functions​

getHumanoidPositionDirection​

HintScoringUtils.getHumanoidPositionDirection(humanoid: Humanoid) → (
Vector3?,--

Position

Vector3?--

LookVector

)

Gets humanoid position and direction.

getAdorneeInRegionSet​

HintScoringUtils.getAdorneeInRegionSet(
position: Vector3,
radius: number,
ignoreList: {Instance},
getAdorneeFunction: (Instance) → Instance?
) → {[Instance]: true}

Finds adornees in a region

debugScore​

HintScoringUtils.debugScore(
adornee: Instance,
score: number
) → ()

Draws the score in debug mode

raycastToAdornee​

HintScoringUtils.raycastToAdornee(
raycaster: Raycaster,
humanoidCenter: Vector3,
adornee: Instance,
closestBoundingBoxPoint: Vector3,
extraDistance: number
) → Vector3--

Hit position

Raycasts to adornee

clampToBoundingBox​

HintScoringUtils.clampToBoundingBox(
adornee: Instance,
humanoidCenter: Vector3
) → (
Vector3?,--

clamped point

Vector3?--

center of bounding box

)

Clamps the humanoid center to the adornee bounding box, finding the nearest point.

INFO

We do this because we want to raycast to the closest point on the adornee, which will ensure we hit it, especially for larger adornees.

scoreAdornee​

HintScoringUtils.scoreAdornee(
adornee: Instance,
raycaster: Raycaster,
humanoidCenter: Vector3,
humanoidLookVector: Vector3,
maxViewRadius: number,
maxTriggerRadius: number,
maxViewAngle: number,
maxTriggerAngle: number,
isLineOfSightRequired: boolean
) → boolean | number--

[0, 1]

Scores the adornee as a target for showing as a target in terms of priority.

scoreDist​

HintScoringUtils.scoreDist(
distance: number,
maxViewDistance: number,
maxTriggerRadius: number
) → number--

[0, 1]

Scores the distance based upon a variety of mechanics

scoreAngle​

HintScoringUtils.scoreAngle(
angle: number,
maxViewAngle: number,
maxTriggerAngle: number
) → number--

[0, 1]

Scores the angle based upon parameters

Show raw api
{
    "functions": [
        {
            "name": "getHumanoidPositionDirection",
            "desc": "Gets humanoid position and direction.",
            "params": [
                {
                    "name": "humanoid",
                    "desc": "",
                    "lua_type": "Humanoid"
                }
            ],
            "returns": [
                {
                    "desc": "Position",
                    "lua_type": "Vector3?"
                },
                {
                    "desc": "LookVector",
                    "lua_type": "Vector3?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 45,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "getAdorneeInRegionSet",
            "desc": "Finds adornees in a region",
            "params": [
                {
                    "name": "position",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "radius",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "ignoreList",
                    "desc": "",
                    "lua_type": "{ Instance }"
                },
                {
                    "name": "getAdorneeFunction",
                    "desc": "",
                    "lua_type": "(Instance) -> Instance?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "{ [Instance]: true }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 63,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "debugScore",
            "desc": "Draws the score in debug mode",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "score",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 85,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "raycastToAdornee",
            "desc": "Raycasts to adornee",
            "params": [
                {
                    "name": "raycaster",
                    "desc": "",
                    "lua_type": "Raycaster"
                },
                {
                    "name": "humanoidCenter",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "closestBoundingBoxPoint",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "extraDistance",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "Hit position",
                    "lua_type": "Vector3"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 109,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "clampToBoundingBox",
            "desc": "Clamps the humanoid center to the adornee bounding box, finding the nearest point.\n\n:::info\nWe do this because we want to raycast to the closest point on the adornee, which will\nensure we hit it, especially for larger adornees.\n:::",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "humanoidCenter",
                    "desc": "",
                    "lua_type": "Vector3"
                }
            ],
            "returns": [
                {
                    "desc": "clamped point",
                    "lua_type": "Vector3?"
                },
                {
                    "desc": "center of bounding box",
                    "lua_type": "Vector3?"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 165,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "scoreAdornee",
            "desc": "Scores the adornee as a target for showing as a target in terms of priority.",
            "params": [
                {
                    "name": "adornee",
                    "desc": "",
                    "lua_type": "Instance"
                },
                {
                    "name": "raycaster",
                    "desc": "",
                    "lua_type": "Raycaster"
                },
                {
                    "name": "humanoidCenter",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "humanoidLookVector",
                    "desc": "",
                    "lua_type": "Vector3"
                },
                {
                    "name": "maxViewRadius",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxTriggerRadius",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxViewAngle",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxTriggerAngle",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "isLineOfSightRequired",
                    "desc": "",
                    "lua_type": "boolean"
                }
            ],
            "returns": [
                {
                    "desc": "[0, 1]",
                    "lua_type": "boolean | number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 191,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "scoreDist",
            "desc": "Scores the distance based upon a variety of mechanics",
            "params": [
                {
                    "name": "distance",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxViewDistance",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxTriggerRadius",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "[0, 1]",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 283,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        },
        {
            "name": "scoreAngle",
            "desc": "Scores the angle based upon parameters",
            "params": [
                {
                    "name": "angle",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxViewAngle",
                    "desc": "",
                    "lua_type": "number"
                },
                {
                    "name": "maxTriggerAngle",
                    "desc": "",
                    "lua_type": "number"
                }
            ],
            "returns": [
                {
                    "desc": "[0, 1]",
                    "lua_type": "number"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 306,
                "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
            }
        }
    ],
    "properties": [],
    "types": [],
    "name": "HintScoringUtils",
    "desc": "Utility functions that let you score a proximity prompt (i.e. a Hint)\nbased upon its relation to a character in 3D space.",
    "source": {
        "line": 8,
        "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
    }
}