Skip to main content

SenseVisual

Debug view of an agent's perception: the sight cone, the hearing and proximity circles, and markers at SeenPosition, PredictedPosition and LastKnownPosition. Exposed as VluxyAI.Debug.SenseVisual. Make one after building the agent, hand it the senses (or their numbers), and destroy it with the agent.

local sight = VluxyAI.Senses.Sight.new({ Range = 40, FieldOfView = 120 })
local agent = VluxyAI.new(rig):UseBrain(Brain):AddSense(sight):Build()
local view = VluxyAI.Debug.SenseVisual.new(agent, { Sight = sight, Hearing = 30 })
agent.Destroyed:Connect(function() view:Destroy() end)

Functions​

new​

SenseVisual.new(
agent: Agent,
) → SenseVisual

Types

​

interface SenseVisualOptions {
Sight: {
Range: number,
FieldOfView: number,
EyeOffset: Vector3?
} | Sense?--

Draw the sight cone from these numbers, or from a Sight sense's own options.

Hearing: number | Sense?--

Draw a circle of this radius, or a Hearing sense's Range.

Proximity: number | Sense?--

Draw a circle of this radius, or a Proximity sense's Range.

Rate: number?--

Redraws per second. Default 10.

SightColor: Color3?--

The cone when nothing is seen. Default amber.

SeenColor: Color3?--

The cone while SeenTarget is set. Default green.

HearingColor: Color3?--

Default blue.

ProximityColor: Color3?--

Default red.

MarkColor: Color3?--

The position markers. Default white.

Transparency: number?--

Of every adornment. Default 0.7.

}

Errors

TypeDescription
stringThe agent is headless.

Refresh​

SenseVisual.Refresh(self: SenseVisual) → ()

Redraws from the agent's current blackboard. Called for you at Rate.

Destroy​

SenseVisual.Destroy(self: SenseVisual) → ()

Removes every adornment and stops redrawing. Safe to call twice.

Show raw api
{
    "functions": [
        {
            "name": "new",
            "desc": "",
            "params": [
                {
                    "name": "agent",
                    "desc": "",
                    "lua_type": "Agent"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "SenseVisualOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "SenseVisual"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "string",
                    "desc": "The agent is headless."
                }
            ],
            "source": {
                "line": 163,
                "path": "lib/Debug/SenseVisual.luau"
            }
        },
        {
            "name": "Refresh",
            "desc": "Redraws from the agent's current blackboard. Called for you at `Rate`.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SenseVisual"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 291,
                "path": "lib/Debug/SenseVisual.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Removes every adornment and stops redrawing. Safe to call twice.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "SenseVisual"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 346,
                "path": "lib/Debug/SenseVisual.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "SenseVisualOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Sight",
                    "lua_type": "{ Range: number, FieldOfView: number, EyeOffset: Vector3? } | Sense?",
                    "desc": "Draw the sight cone from these numbers, or from a [Sight] sense's own options."
                },
                {
                    "name": "Hearing",
                    "lua_type": "number | Sense?",
                    "desc": "Draw a circle of this radius, or a [Hearing] sense's `Range`."
                },
                {
                    "name": "Proximity",
                    "lua_type": "number | Sense?",
                    "desc": "Draw a circle of this radius, or a [Proximity] sense's `Range`."
                },
                {
                    "name": "Rate",
                    "lua_type": "number?",
                    "desc": "Redraws per second. Default `10`."
                },
                {
                    "name": "SightColor",
                    "lua_type": "Color3?",
                    "desc": "The cone when nothing is seen. Default amber."
                },
                {
                    "name": "SeenColor",
                    "lua_type": "Color3?",
                    "desc": "The cone while `SeenTarget` is set. Default green."
                },
                {
                    "name": "HearingColor",
                    "lua_type": "Color3?",
                    "desc": "Default blue."
                },
                {
                    "name": "ProximityColor",
                    "lua_type": "Color3?",
                    "desc": "Default red."
                },
                {
                    "name": "MarkColor",
                    "lua_type": "Color3?",
                    "desc": "The position markers. Default white."
                },
                {
                    "name": "Transparency",
                    "lua_type": "number?",
                    "desc": "Of every adornment. Default `0.7`."
                }
            ],
            "source": {
                "line": 47,
                "path": "lib/Debug/SenseVisual.luau"
            }
        }
    ],
    "name": "SenseVisual",
    "desc": "Debug view of an agent's perception: the sight cone, the hearing and proximity circles, and\nmarkers at `SeenPosition`, `PredictedPosition` and `LastKnownPosition`. Exposed as\n`VluxyAI.Debug.SenseVisual`. Make one after building the agent, hand it the senses (or their\nnumbers), and destroy it with the agent.\n\n```lua\nlocal sight = VluxyAI.Senses.Sight.new({ Range = 40, FieldOfView = 120 })\nlocal agent = VluxyAI.new(rig):UseBrain(Brain):AddSense(sight):Build()\nlocal view = VluxyAI.Debug.SenseVisual.new(agent, { Sight = sight, Hearing = 30 })\nagent.Destroyed:Connect(function() view:Destroy() end)\n```",
    "source": {
        "line": 155,
        "path": "lib/Debug/SenseVisual.luau"
    }
}