Skip to content

Smell

The Smell sensor works by emitting a Scent at a specific point with a tag. Emitting more scents links them together creating a chain similar to a breadcrumb trail that Perception components can pick to react or follow.

Settings

Perception Smell Settings

The Update field allows to choose whether the Perception component updates its smell sensor every frame, at a specific interval, or manually using a custom script.

Update every frame

If you are starting out we recommend leaving the update mode to Every Frame. Interval and Manual can be used to improve performance at the expense of precision.

The Radius determines how far the Perception component can smell a scent. Increasing this value allows agents to smell farther scents.

The Use Obstruction field allows scents to be blocked by Obstruction components.

Without Obstruction

If your game is set on on an open area or don't want scents to be blocked by Obstruction components, untick the Use Obstruction checkbox. It will save some performance overhead.

The Min Intensity field allows to define a minimum threshold at which scents are caught. See the Emitting Scents section for more information about how scents work.

Emitting Scents

Scents are one or more points in space connected by their lifetime value, identified by a tag name.

Each time a new Scent is emitted, it is connected to the previous scent with the same tag, allowing to traverse the scent trail from the oldest to the newest point.

Perception Smell Scent Trail

The instruction Emit Scent can be used to emit a new scent at a specific point.

Perception Smell Scent Trail

The Source field is a game object emitting the scent and its position is equal to that game object's point in space.

The Tag field is a string that identifies the scent. If there already is one or more scents with the same tag, they will be automatically connected forming a trail of breadcrumbs that other characters can track.

The Duration field specifies the time it takes to dispel the scent.

The Intensity field is a numeric value that indicates how strong the scent is when it starts.

Intensity fades over time

Note that the Intensity of a scent fades over time, similar to how gas dispels in real-life. This means that a scent with an intensity of 1 and a duration of 5 seconds will have an intensity of 0.5 after 2.5 seconds have passed.

Catching Scents

The Perception component doesn't inherently increase its Awareness upon smelling a scent, unlike the sight sensor. This is because each scent tag can mean something different.

To react to scents the On Smell Trigger can be used, which is executed whenever the Perception component enters a zone with a scent.

Perception On Smell Trigger

Once a Perception component catches a whiff of a scent it can increase the Awareness using the Increment Awareness instruction or even follow the scent trail.

Following Scents

A character can query the current point in space of a specific scent, as well as the next scent point (if it exists), using the Position property.

This allows characters to follow a scent trail by attempting to go to the next scent point from the one whiffed.

Move To...

Perception Move To with Follow Scent

For example you can use the Move Character To instruction with the Follow Scent option, which selects the next scent point from the closest one, effectively making the character follow the scent like a trail of breadcrumbs.