Skip to main content
Version: 0.15.0

Interest Spots

An interest spot is something passing agents may stop for: a shop window, a notice board, a street performer. An agent that walks past may break off, go and stand at the spot for a while, and then carry on with what it was doing.

Interest spots are built on Interrupts. Read that page first for interrupt kinds and how to author the reaction an agent plays.

The short version​

  1. Create an Interrupt Kind and a reaction for it in the Reactive tree.
  2. Add the InterestSpot component to the object and set its Kind.
  3. Add a child object with a Sphere Collider and the InterestSpotVolume component. Size the collider to cover the path agents walk.
  4. For a crowd, set Shape to Gathering and assign a Mark Group to Audience Marks.

The Interest Spot component​

FieldWhat it does
KindThe interrupt kind offered to passing agents
ShapeSolo for one visitor at a time, Gathering for several
Activity EnabledWhether the spot is offering. Off, nobody stops
ProbabilityThe chance an agent stops, from 0 to 1. Rolled once each time the agent enters the volume
Spot Cooldown SecondsHow long after one agent accepts before the spot offers to another
RequirementsOptional. Only agents that meet these are offered. See Requirement System
AnchorSolo only. The item the visitor stands at. Leave empty to use the Item on the same object
Audience MarksGathering only. The mark group the audience stands on

Solo​

One agent at a time visits the spot, standing at the anchor item's use spot. The spot makes no offers while a visitor is there, or while the item is reserved or in use by an agent doing something else.

Gathering​

Several agents visit at once, each on its own mark. The spot stops offering when every mark is taken.

A gathering fills gradually. Only one agent is taken at a time, and Spot Cooldown Seconds sets the wait before the next. Lower it for a crowd that builds quickly.

Probability​

The roll happens once per visit to the volume. An agent that fails it is left alone until it walks out and comes back in, so 0.15 means roughly one passer-by in seven stops, however long each takes to walk through.

Turning a spot on and off​

Activity Enabled can be set from your own code, so a performer only draws a crowd while performing:

csharp
interestSpot.ActivityEnabled = true;

Disabling the component, or the volume, sends every current visitor back to what it was doing.

The Interest Spot Volume component​

The volume is the area in which passing agents are noticed. It needs a collider set as a trigger and a kinematic Rigidbody. Adding the component sets both up for you.

FieldWhat it does
SpotThe interest spot this volume belongs to. Leave empty to use one on the same object or a parent
Offer Tick IntervalSeconds between rounds of offers while agents are inside
Max Offers Per TickHow many agents are considered each round. Agents are taken in turn, so a crowded volume stays cheap
note

The Rigidbody is there because agents have none of their own, and Unity only reports trigger overlaps when one side has a Rigidbody. Keep it kinematic.

Size the volume to the route agents take, not to the spot itself. An agent only gets its chance while it is inside, so a volume it clips the corner of gives it one round of offers at most.

An empty volume costs nothing. It does no work until an agent walks in.

How long a visitor stays​

The spot does not set this. The length comes from the endpoint behaviour on the reaction's action, so every spot using the same kind holds its visitors for the same time. Create a second kind and reaction for a spot that should hold agents longer.

Which agents stop​

An agent is offered the spot when all of these are true:

  • Activity Enabled is on and the spot cooldown has run out
  • the spot has room
  • the agent is not already handling an interrupt
  • the agent meets the Requirements
  • the agent's roll against Probability passes

The agent can still turn it down. Passing agents are asked at the Polite tier, so an agent that has already arrived at its task and begun is left to finish. The kind's cooldown and weight apply as well. See When an agent says no.

Common problems​

SymptomCause
Nobody ever stopsThe volume's collider is not a trigger, agents do not pass through it, or Activity Enabled is off
Agents are offered but decline with NoHandlerForKindThere is no reaction for the kind, or Reactive is None in module settings
Agents stop once and never againThe kind's Agent Cooldown Seconds. An agent also only rolls again after leaving the volume
A gathering only ever has one or two watchingSpot Cooldown Seconds is long compared with how long each visitor stays
A solo spot is never visitedThe anchor item is reserved or in use, or there is no Item on the object and Anchor is empty
Agents at work walk straight pastThe kind's weight does not beat the work weight, 0.7 by default. See Weight
Visitors all face the same wayThe reaction's Look is not FACE_INTERRUPT_TARGET, or the marks all point the same way
The Console reports the collider must be a triggerTick Is Trigger on the volume's collider, or agents will walk into it

Next step​

Continue to Service Points, or open the Interrupt Scene from Example Scenes to see a solo spot and a gathering side by side.