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(humanoidHumanoid) → (
Vector3?,--

Position

Vector3?--

LookVector

)

Gets humanoid position and direction.

getAdorneeInRegionSet

HintScoringUtils.getAdorneeInRegionSet(
positionVector3,
radiusnumber,
ignoreList{Instance},
getAdorneeFunction(Instance) → Instance?
) → {[Instance]true}

Finds adornees in a region

debugScore

HintScoringUtils.debugScore(
adorneeInstance,
scorenumber
) → ()

Draws the score in debug mode

raycastToAdornee

HintScoringUtils.raycastToAdornee(
raycasterRaycaster,
humanoidCenterVector3,
adorneeInstance,
closestBoundingBoxPointVector3,
extraDistancenumber
) → Vector3--

Hit position

Raycasts to adornee

clampToBoundingBox

HintScoringUtils.clampToBoundingBox(
adorneeInstance,
humanoidCenterVector3
) → (
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(
adorneeInstance,
raycasterRaycaster,
humanoidCenterVector3,
humanoidLookVectorVector3,
maxViewRadiusnumber,
maxTriggerRadiusnumber,
maxViewAnglenumber,
maxTriggerAnglenumber,
isLineOfSightRequiredboolean
) → boolean | number--

[0, 1]

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

scoreDist

HintScoringUtils.scoreDist(
distancenumber,
maxViewDistancenumber,
maxTriggerRadiusnumber
) → number--

[0, 1]

Scores the distance based upon a variety of mechanics

scoreAngle

HintScoringUtils.scoreAngle(
anglenumber,
maxViewAnglenumber,
maxTriggerAnglenumber
) → 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": 43,
                "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": 61,
                "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": 83,
                "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": 104,
                "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": 154,
                "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": 180,
                "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": 267,
                "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": 290,
                "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": 7,
        "path": "src/hintscoringutils/src/Client/HintScoringUtils.lua"
    }
}