SafeAreas
Places agents never go. Tag a part VLUXYAI_SAFE and it is a safe area for as long as its
VLUXYAI_SAFE/Enabled attribute is not false; set the attribute to switch it off and on.
Call SafeAreas.Setup once on the server so the part gets its navmesh modifier and is solid
to agent rigs. The rest is automatic: Navmesh never plans through an enabled area, Straight
never walks a line across one, Graph skips nodes in one when given Avoid = SafeAreas.Contains, and a player standing in one is left out of
Perception.AliveRoots, so no sense targets them.
VluxyAI.SafeAreas.Setup({ RigGroup = "Monsters" })
Properties
TAG
SafeAreas.TAG: "VLUXYAI_SAFE"ENABLED_ATTRIBUTE
SafeAreas.ENABLED_ATTRIBUTE: "VLUXYAI_SAFE/Enabled"false switches an area off. Missing means on.
LABEL
SafeAreas.LABEL: "VLUXYAI_SAFE"
The PathfindingModifier label SafeAreas.Setup gives an enabled area, and the cost
Navmesh prices at math.huge.
Functions
IsEnabled
InBox
SafeAreas.InBox() → boolean--
true when point is inside the box, rotation included.
Pure.
Contains
SafeAreas.Contains(point: Vector3) → (boolean,--
true when point is inside an enabled safe area.
BasePart?--
That area.
)The check every layer uses. A floor position counts as inside a room whose part reaches the floor; give a safe part a little depth below the floor if yours sits on it exactly.
Refresh
SafeAreas.Refresh() → ()Makes safe areas solid to the rig group and to no other collision group, including groups registered since SafeAreas.Setup (a new group collides with everything by default). Setup calls it, and so does every safe area added later; call it yourself after registering a collision group of your own.
Setup
Types
interface SafeAreaSetupOptions {RigGroup: string?--
The collision group your agent rigs are in. A safe area is solid to it and to nothing else. Default Collision.RIG_GROUP, the group Collision.AddRig puts rigs in.
}
Server setup, once. Every tagged part, now and later, gets a PathfindingModifier (labelled
VLUXYAI_SAFE while enabled, so Navmesh prices it out) and goes in a collision group that only
collides with RigGroup, solid while enabled and not while off. Players and everything else
pass through it.
Errors
| Type | Description |
|---|---|
| "unknown option" |