> ## Documentation Index
> Fetch the complete documentation index at: https://docs.teriyakigaming.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Ink Page Interactor

> The demo look-at-and-press-a-key interaction: a focus line trace, a prompt event, and editable default keys that make pages readable out of the box.

**Ink Page Interactor** (`UInkPageInteractorComponent`) is the demo "look at a page,
press a key, read it" interaction. It line-traces from the player's view for an actor
carrying an [Ink Page Display](/plugins/inkwell/components/page-display) component, raises a focus event
you can drive a "Press E to read" prompt from, and drives an
[Ink Page Reader](/plugins/inkwell/components/reader) to snap the page into view.

<Warning>
  **This is a demo/reference implementation — not recommended for production.** It exists so
  the showroom plays out of the box and so there is a complete, working example of what
  *your* interaction system should call on the reader: **Begin Reading** / **End Reading**
  when your interact verb fires, **Next Page** / **Previous Page** / **Flip Page** for
  turning. The same goes for the rest of the bundled interaction pieces — the demo
  character, game mode, exhibit component and prompt widget.

  If your project has an interaction system — an interactable base Blueprint, an interface,
  a focus/prompt manager, its own trace — **do not add this component**. Keep your system
  and call the [Ink Page Reader](/plugins/inkwell/components/reader) from it. That is a handful of nodes,
  spelled out step by step in the [integration guide](/plugins/inkwell/guides/integration). The reader is
  the production component; this one is the scaffolding around it.
</Warning>

<CardGroup cols={2}>
  <Card title="Prototyping, or no interaction system yet" icon="flask">
    Add this component to your pawn. You get focus detection, a reader, and working keys from
    one component with no wiring.
  </Card>

  <Card title="You already have an interaction system" icon="plug" href="/plugins/inkwell/guides/integration">
    Skip this component entirely. Call **Begin Reading Actor** / **End Reading** /
    **Next Page** on the reader from the code you already have.
  </Card>
</CardGroup>

## What one component gets you

Add **Ink Page Interactor** to your player pawn from the **Add Component** menu (category
**Inkwell**). At Begin Play it assembles a complete setup:

* **A reader.** It looks for an [Ink Page Reader](/plugins/inkwell/components/reader) on the same actor
  and reuses it if there is one, so any reader settings you tuned are respected. If there
  is none it creates one, named `InkPageReader`, and notes it in a verbose `LogInkwell`
  message. **Get Reader** returns whichever one it is driving, so you can change the fit
  properties or the input locks at runtime.
* **Focus tracing.** Every **Focus Check Interval** seconds it traces from the player's
  view and tracks which page display, if any, is under the crosshair.
* **Default keys.** With **Enable Default Input** on, it binds a small set of keys on the
  owning pawn so the whole loop works with nothing wired. The keys themselves are
  editable properties.

The component is spawnable but not Blueprintable: add it to an actor, do not subclass it.
Everything it does is available as Blueprint functions instead. The showroom's demo
character (`AInkwellReaderCharacter`) carries one, which is why the showroom reads with
no setup.

## The focus line trace

The trace starts at the player's view point — the possessing controller's view point when
the owner is a pawn (the same resolution the reader uses), or the actor's eyes otherwise
— and runs along the view direction for **Interaction Distance** centimeters.

* It is a **single line trace by channel** on **Trace Channel**, against **simple**
  collision, ignoring the owning actor.
* Whatever actor the **first blocking hit** returns is asked for an Ink Page Display
  component. A wall between the player and the page means no focus.
* A display whose **Can Be Picked Up** is off is scenery — the showroom's wall poster, a
  shop sign. It renders normally, but for focus purposes the trace hit nothing: no
  prompt, and **Interact** never sees it.
* **On Focus Changed** broadcasts once per transition, not once per trace. A focused page
  that is destroyed counts as a focus loss, so listeners still get their "prompt off"
  broadcast with a null page.
* While a page is being read there is **no world focus**: it is cleared the instant reading
  starts, so the prompt hides immediately, and tracing pauses until the page is put back.

<Warning>
  A page you can walk up to but never focus is nearly always a collision-channel mismatch.
  The [Ink Page](/plugins/inkwell/components/page-actor) sheet and the
  [Ink Page Stack](/plugins/inkwell/components/page-stack)'s sheets must answer the channel in
  **Trace Channel**. Stack sheets answer **only** their own **Sheet Trace Channel** and
  ignore every other channel — both default to **Visibility**, so out of the box they
  agree, but if you move one to a project trace channel you must move the other with it.
  The mismatch produces no warning anywhere: the trace passes through the pile as if it
  were not there.
</Warning>

### Debugging the trace

Turn on **Draw Debug Trace** to see every focus trace: the line is **green** when it lands
on a readable page and **red** otherwise, with a small ring laid flat against the surface
at the impact point. Each line lives one focus interval plus a little slack, so it never
flickers out between traces. Debug drawing has no effect in Shipping or Test builds.

## Properties

All properties live under **Inkwell → Interaction**, are editable per instance, and are
readable and writable from Blueprint.

| Property                                         | Type              | Default      | What it does                                                                                                                      |
| ------------------------------------------------ | ----------------- | ------------ | --------------------------------------------------------------------------------------------------------------------------------- |
| **Interaction Distance** (`InteractionDistance`) | Float             | `300.0`      | How far away, in centimeters, a page can be and still be picked up by the focus trace.                                            |
| **Trace Channel** (`TraceChannel`)               | Collision Channel | `Visibility` | Channel the focus trace runs on. Visibility suits most projects and matches the Ink Page Stack's **Sheet Trace Channel** default. |
| **Focus Check Interval** (`FocusCheckInterval`)  | Float             | `0.1`        | Seconds between focus traces. `0` traces every tick; the default is plenty for a reticle prompt.                                  |
| **Draw Debug Trace** (`bDrawDebugTrace`)         | Boolean           | `false`      | Draw each focus trace, green on a hit and red otherwise, with a ring at the impact point. No effect in Shipping or Test builds.   |
| **Enable Default Input** (`bEnableDefaultInput`) | Boolean           | `true`       | Bind the default keys below on the owning pawn. Turn this off as soon as you wire your own input.                                 |
| **Interact Key** (`InteractKey`)                 | Key               | `E`          | Toggles reading the focused page. Editable only while **Enable Default Input** is on.                                             |
| **Put Back Key** (`PutBackKey`)                  | Key               | `Q`          | Puts the page being read back down. Editable only while **Enable Default Input** is on.                                           |
| **Next Page Key** (`NextPageKey`)                | Key               | `Right`      | Turns the page being read forward; **mouse wheel up** always does too. Editable only while **Enable Default Input** is on.        |
| **Previous Page Key** (`PreviousPageKey`)        | Key               | `Left`       | Turns the page being read back; **mouse wheel down** always does too. Editable only while **Enable Default Input** is on.         |

## Default key bindings

With **Enable Default Input** on, these bindings land on the owning pawn's input
component:

| Input                                                                   | Action                                                 |
| ----------------------------------------------------------------------- | ------------------------------------------------------ |
| **Interact Key** (default **E**)                                        | Open the focused page, or put down the page being read |
| **Put Back Key** (default **Q**)                                        | Put the page being read back down                      |
| **Next Page Key** (default **Right arrow**) and **mouse wheel up**      | Turn to the next page                                  |
| **Previous Page Key** (default **Left arrow**) and **mouse wheel down** | Turn to the previous page                              |

The mouse-wheel bindings are always added alongside the two page keys; they are not
separately configurable. Flipping a page over is **not** this component's key: the
reader binds its own **Flip Key** (default **F**) under its separate **Bind Flip Key**
toggle, because flipping is a reader operation — see
[Ink Page Reader](/plugins/inkwell/components/reader#turning-the-sheet-over).

How the bindings behave:

* They are plain key bindings, which **still fire under Enhanced Input's** player input —
  no input actions or mapping contexts required to try the plugin.
* None of them **consume input**, so movement, look and your own bindings on the same keys
  pass through untouched.
* A pawn usually gets its input component after this component's Begin Play, so the
  interactor retries the binding from its tick until the pawn has one. The keys are bound
  at most once.

### Moving to your own input

Turn **Enable Default Input** off the moment you bind your own — otherwise both fire. Then
call the functions below from your own input events.

The plugin ships example Enhanced Input assets for exactly this, under
`/Inkwell/Examples/Input/`:

| Asset             | Bind it to        |
| ----------------- | ----------------- |
| `IA_Interact`     | **Interact**      |
| `IA_PutBack`      | **Stop Reading**  |
| `IA_NextPage`     | **Next Page**     |
| `IA_PreviousPage` | **Previous Page** |

`IMC_InkwellDefault` in the same folder is a ready-made mapping context binding them to
E, Q, Right/wheel up and Left/wheel down. Add it (or your own context) to your character,
bind the actions in the Event Graph, and route each to the matching function.

## Events

| Event                                   | When it fires                             | Payload                                                                                                                         |
| --------------------------------------- | ----------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------- |
| **On Focus Changed** (`OnFocusChanged`) | The page under the player's view changes. | **New Focus** — the Ink Page Display now being looked at, or **null when focus was lost**, including the moment reading begins. |

Drive your prompt from it: show the prompt when **New Focus** is valid, hide it when it is
null. That single event is all a reticle prompt needs.

The bundled prompt widget `/Inkwell/Examples/UI/WBP_InkwellReadPrompt` — demo-only, like
this component — is a working example. It is parented to the C++ base
`UInkwellReadPromptBase`, which finds the interactor and reader on the owning player pawn
and composes its prompt line from what the page actually is: `E : Read` while a page is
focused, then while one is up a line built per page — multipage documents get "Turn page"
and a page counter, a single sheet with an authored back gets "Flip over" (or "Flip back"),
and a plain single sheet gets no turning prompt at all. An Inkwell Exhibit component on
the page's actor can override the line per exhibit. Create it and add it to the viewport
from your HUD or character; it needs no configuration, but it does assume the default
keys.

## Blueprint API

| Node                 | Returns          | What it does                                                                                                                                                                                                                          |
| -------------------- | ---------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Interact**         | —                | Toggles reading: opens the focused page, or puts down the page being read. Does nothing when nothing is focused and nothing is up.                                                                                                    |
| **Stop Reading**     | —                | Puts the page being read back down. Does nothing otherwise.                                                                                                                                                                           |
| **Next Page**        | Boolean          | Turns the page being read forward (through the reader, so [book order](/plugins/inkwell/components/reader#book-order) applies). Works only while reading; false otherwise, or on the last page with the display's **Loop Pages** off. |
| **Previous Page**    | Boolean          | Turns it back. False when not reading, or on the first page with **Loop Pages** off.                                                                                                                                                  |
| **Get Focused Page** | Ink Page Display | The page under the player's view, or null. **Always null while reading.**                                                                                                                                                             |
| **Is Reading**       | Boolean          | True while a page is snapped into view. Reports the reader's state.                                                                                                                                                                   |
| **Get Reader**       | Ink Page Reader  | The reader this interactor drives — found or created on the owner at Begin Play.                                                                                                                                                      |

## Relationship to the reader

The interactor does none of the snap-into-view work. Everything you can see and feel — the
float-up blend, the fit-to-view framing, the flip, **Follow Camera**, the movement and
look locks, the physics and collision capture — belongs to the
[Ink Page Reader](/plugins/inkwell/components/reader) and is configured there.

That split is what makes leaving the demo component cheap. To move off it:

<Steps>
  <Step title="Add a reader of your own">
    Add an **Ink Page Reader** component to the pawn explicitly and set its properties. The
    interactor reuses it instead of creating one, so nothing changes yet.
  </Step>

  <Step title="Take over the input">
    Turn **Enable Default Input** off and call **Interact** / **Stop Reading** /
    **Next Page** / **Previous Page** from your own input events. Still nothing else changes.
  </Step>

  <Step title="Take over the focus">
    Replace **On Focus Changed** with whatever your interaction system already broadcasts for
    focus, and prompt from that.
  </Step>

  <Step title="Remove the interactor">
    Delete the component and call **Begin Reading Actor** / **End Reading** / **Next Page**
    on the reader directly from your interaction code. See the
    [integration guide](/plugins/inkwell/guides/integration).
  </Step>
</Steps>

<Tip>
  Reading state lives on the reader, so if some other system starts a read on the same
  reader while the interactor is still attached, the interactor plays along correctly: it
  clears its focus, pauses tracing, and its put-back key puts that page back too.
</Tip>

## Next

<CardGroup cols={2}>
  <Card title="Integration guide" icon="plug" href="/plugins/inkwell/guides/integration">
    The path production projects should take: your interaction system, Inkwell's reader.
  </Card>

  <Card title="Ink Page Reader" icon="book-open-reader" href="/plugins/inkwell/components/reader">
    The production component: the reading pose, the flip, the locks and the events.
  </Card>

  <Card title="Examples tour" icon="box-open" href="/plugins/inkwell/guides/examples">
    The showroom, its demo character and exhibits, the prompt widget and input assets.
  </Card>
</CardGroup>
