Skip to main content
Version: 0.13.0

Use Spots

A use spot is the position an agent walks to when it wants to interact with an item.

Before 0.13.0 agents walked to the item's own transform, which for anything with physical size meant walking into the middle of it — standing inside a bed rather than beside it, or clipping through a workbench. Use spots let you say exactly where the agent should stand.

The short version

Add a child GameObject named exactly Use Spot to your item, position it where the agent should stand, and you are done. Everything else on this page is refinement.

The name must match exactly, including the space and capitalisation.

How a position is resolved

When an agent needs to reach an item, the system works through three tiers and takes the first that produces a position:

  1. The Action POI matching the action's ID. Only consulted when the action's endpoint behaviour has poiAction enabled. This lets one item offer different standing positions for different actions.
  2. The item's default use spot. The Use Spot field on the Item component if assigned, otherwise a direct child named Use Spot.
  3. The item's own transform. The pre-0.13.0 behaviour, and the reason existing content keeps working unchanged.

So an item with no use spot behaves exactly as it did before, and an item with a Use Spot child improves every action that touches it without any per-action setup.

Setting one up

The simple case

  1. Select your item in the Hierarchy.
  2. Right-click it and choose Create Empty to add a child.
  3. Rename the child to Use Spot.
  4. Move it to where the agent should stand. Face its blue forward axis toward the item if you plan to use FACE_USE_SPOT_FORWARD.

The shipped example furniture uses (0, 0, -0.9) relative to the item, which puts the agent just in front of a chair or bed.

Using a different object

The Item component has a Use Spot field. Assign any transform to it and that wins over the child lookup. Useful when the position you want already exists as part of a prefab, or when several items should share one standing position.

Leave it empty to fall back to the Use Spot child.

note

The resolved spot is cached. If you move or reassign a use spot from a script at runtime, call InvalidateUseSpot() on the item so the next lookup re-resolves.

Per-action spots

An item that supports several actions can offer a different position for each. On the item's Action POI, set the Spot field to the transform for that action.

The POI inspector describes the fallback in place:

Where an agent stands to perform this action. Leave empty to fall back to the item's 'Use Spot' child, and then to the item itself.

For this tier to be consulted at all, the action's endpoint behaviour must have poiAction enabled. Without it, the action falls straight through to the item's default use spot.

A matching POI that has no centre assigned does not end the search — resolution continues to the next candidate rather than returning nothing.

Facing the right way

Standing in the right place is only half of it. The LOOKING_TYPES option on an action controls which way the agent turns once it arrives:

ValueBehaviour
NONENo facing applied
FACE_CLOSEST_ITEMTurn toward the nearest item
FACE_CLOSEST_OWNED_ITEMTurn toward the nearest item the agent owns
FACE_SAME_AS_GOAL_ITEMMatch the goal item's rotation
FACE_SAME_AS_CLOSEST_ITEMMatch the nearest item's rotation
FACE_USE_SPOT_FORWARDFace the direction the use spot itself is pointing

FACE_USE_SPOT_FORWARD is usually what you want with a use spot: rotate the use spot object so its blue forward axis points at the item, and the agent will face the item on arrival regardless of which direction it approached from.

warning

LOOKING_TYPES values serialise as integers into every authored action. New members are appended to the end of the enum for that reason. If you extend the enum yourself, append — inserting a value in the middle silently remaps the look-at of every existing node.

What else this changed

Use spots affect more than pathing targets:

  • Reach checks. Whether an agent is close enough to pick an item up is measured against the use spot, not the item centre.
  • Goal validation. IGoalValidation.HasValidGoal takes an optional use spot action ID so validation and pathing agree on the same target.
  • Saved games. A restored action re-resolves its location from the action itself, so a use spot you have moved since saving is picked up rather than the old position being restored.

Common problems

SymptomCause
Agent still walks into the itemThe child is not named exactly Use Spot, or it is a grandchild rather than a direct child
Agent stands in the right place but faces the wrong waySet the action's looking type to FACE_USE_SPOT_FORWARD and rotate the use spot
Per-action spot ignoredThe action's endpoint behaviour does not have poiAction enabled
Position changes at runtime are ignoredCall InvalidateUseSpot() after moving the spot

Next step

Continue to Agent Inventory, or see Example Scenes for items already set up this way.