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

# Enable Ray Cast

> Enable pointer-based ray casting input mode for object interaction

## Overview

The **Enable Ray Cast** action enables ray casting input mode, where learners use a ray or pointer to interact with objects at a distance rather than direct touch or click. The pointer projects from a fixed point (usually the center of the screen or from the learner's hand) and intersects with objects in the scene.

Ray casting is useful for interactions where direct clicking isn't appropriate or where pointer-style input provides better interaction feedback.

## When to Use

* **Pointer-based input** — Learners interact through a crosshair or pointer rather than direct object clicking
* **Fixed position interactions** — The learner is locked in place and must interact via pointer
* **AR/VR scenarios** — Ray casting is the standard interaction method in immersive environments
* **Mobile compatibility** — Ray casting often provides more reliable interaction on touch devices
* **Accessibility** — Pointer-based input may be more accessible for certain learners
* **Specific interaction patterns** — Some training scenarios require pointing-based feedback rather than direct touch

## Parameters

| Parameter | Type | Required | Description                                                       |
| --------- | ---- | -------- | ----------------------------------------------------------------- |
| None      | —    | —        | No parameters. Enable Ray Cast activates pointer-based input mode |

## Example: Activate Ray Casting

```
Action: Enable Ray Cast
```

Ray casting input mode is enabled. Objects in the scene respond to pointer input instead of direct clicks.

## Ray Casting vs. Direct Click Interaction

<Tabs>
  <Tab title="Direct Click (Default)">
    * **Standard interaction mode** for browser-based trainings
    * User clicks/taps directly on objects in the 3D scene
    * Works with mouse, touch, and trackpad
    * Intuitive for desktop and mobile users
    * Objects respond to clicks on their visual surface
  </Tab>

  <Tab title="Ray Cast (Pointer)">
    * **Pointer-based interaction** mode
    * A ray projects from a fixed point (center of screen or hand origin)
    * Learner aims the pointer at objects to interact
    * Common in AR/VR applications
    * Useful for fixed-position or immersive scenarios
    * Better for large scenes or distant objects
  </Tab>
</Tabs>

## Best Practices

<Steps>
  <Step title="Use sparingly">
    Most web-based trainings work fine with default click interaction. Use ray casting only when the scenario specifically benefits from pointer input.
  </Step>

  <Step title="Explain to learners">
    Use **Show Panel** or **Show Text** to explain how to use the pointer to interact.
  </Step>

  <Step title="Test interaction feedback">
    Verify that objects clearly respond to pointer intersection — learners need clear visual cues.
  </Step>

  <Step title="Consider mobile experience">
    Ray casting behavior may feel different on touch devices. Test thoroughly.
  </Step>

  <Step title="Combine with positioning actions">
    Pair with **Teleport User To** and **Disable Self Teleport** to lock the learner in a specific position for ray casting.
  </Step>

  <Step title="Document the interaction method">
    Explicitly tell learners they are using pointer-based interaction, not direct clicking.
  </Step>
</Steps>

## Common Patterns

### Pointer-Based Selection

```
State: SelectObjectWithPointer
  onEntry:
    → Enable Ray Cast
    → Disable Self Teleport (Disabled: true)
    → Teleport User To [observation-position]
    → Show Panel
        Title: "Identify the Defect"
        Display Text: "Use the pointer to select the faulty component. Hover over objects to highlight them."
        Billboard: true
    → Set Interactable Objects (["component-a", "component-b", "component-c"], true)

  transitions:
    - event: "component-a-selected"
      action: Show Text "Correct! That is the faulty component."
      target: "DefectIdentified"
    - event: "component-b-selected"
      action: Show Red Vignette
      target: "SelectObjectWithPointer"
    - event: "component-c-selected"
      action: Show Red Vignette
      target: "SelectObjectWithPointer"

  onExit:
    → Hide Panel
    → Hide Text
```

The learner is locked in a fixed position and uses the pointer to select the correct component.

### Inspection from Fixed Viewpoint

```
State: InspectFromPosition
  onEntry:
    → Enable Ray Cast
    → Teleport User To [inspection-position]
    → Disable Self Teleport (Disabled: true)
    → Show Text "Use the pointer to inspect each component. Click to examine details."
    → Set Interactable Objects (["component-1", "component-2", "component-3"], true)

  transitions:
    - event: "component-1-inspected"
      action: Show Panel (Title: "Component 1", Display Text: "Dimensions: 50mm x 30mm. Status: Good")
      target: "InspectFromPosition"

  onExit:
    → Hide Text
```

The learner inspects multiple components from a fixed viewpoint using the ray cast pointer.

### AR/Mixed Reality Interaction

```
State: ARObjectPlacement
  onEntry:
    → Enable Ray Cast
    → Show Panel
        Title: "Place the Object"
        Display Text: "Use the pointer to aim at the target location, then click to place."
        Billboard: true
    → Set Interactable Objects (["placement-area"], true)

  transitions:
    - event: "object-placed"
      target: "PlacementComplete"

  onExit:
    → Hide Panel
```

Ray casting is enabled for AR-style object placement interaction.

### Distance-Based Selection

```
State: SelectFromDistance
  onEntry:
    → Enable Ray Cast
    → Teleport User To [viewing-position]
    → Disable Self Teleport (Disabled: true)
    → Show Text "Select the safety hazards using the pointer. Click on any dangerous areas."
    → Set Interactable Objects (["hazard-1", "hazard-2", "hazard-3", "hazard-4"], true)

  transitions:
    - event: "hazard-identified"
      action:
        - Record achievement "Hazard identified"
        - Show Text "Good catch!"
      target: "SelectFromDistance"
    - event: "all-hazards-found"
      target: "AssessmentComplete"

  onExit:
    → Hide Text
```

The learner identifies multiple hazards from a distance using the pointer.

## Important Notes

* **Browser support** — Ray casting requires WebGL and modern browser capabilities
* **Desktop vs. mobile** — Ray casting works on both, but feel and feedback may differ
* **Not default for web** — Most Creator Studio trainings use standard click interaction; ray casting is for specific scenarios
* **Combination with other inputs** — Can be combined with **Disable Self Teleport** and **Teleport User To** for full control

## Related Actions

* **Disable Self Teleport** — Lock learner position when using ray cast pointer
* **Teleport User To** — Position learner at the optimal viewing point for ray casting
* **Set Interactable Objects** — Restrict which objects respond to ray cast input
* **Show Panel** — Explain ray casting interaction method to learners
