Skip to content

feat: Report the resolved camera in raycast responses#1904

Merged
hatayama merged 1 commit into
feature/pause-point-round5-integrationfrom
feat/raycast-resolved-camera
Jul 21, 2026
Merged

feat: Report the resolved camera in raycast responses#1904
hatayama merged 1 commit into
feature/pause-point-round5-integrationfrom
feat/raycast-resolved-camera

Conversation

@hatayama

@hatayama hatayama commented Jul 21, 2026

Copy link
Copy Markdown
Owner

Summary

  • raycast now reports which camera the ray was actually cast from, on every response (hit and no-hit alike).

User Impact

  • Before: when a scene had more than one MainCamera-tagged camera, Camera.main could resolve to a camera the agent didn't expect, and a "No physics hit" response gave no way to tell which camera was actually used. A round5 dogfooding session got stuck on exactly this.
  • After: every raycast response includes CameraName and CameraPath for the resolved camera, so a surprising "no hit" can be diagnosed immediately instead of assuming the intended camera was used.

Changes

  • Add CameraName/CameraPath to RaycastResponse (additive, existing fields unchanged).
  • Thread the resolved Camera.main through GameViewRaycastUtility's result so RaycastTool can report it on both the hit and no-hit paths.

Verification

  • dist/darwin-arm64/uloop compile --project-path . — 0 errors, 0 warnings.
  • dist/darwin-arm64/uloop run-tests --filter-type regex --filter-value RaycastToolTests --test-mode EditMode — 6/6 passed.
  • dist/darwin-arm64/uloop run-tests --filter-type regex --filter-value Raycast --test-mode EditMode — 54/54 passed (full regression across raycast-related tests).
  • Confirmed Red→Green: ran the new tests before the implementation (compile errors for missing CameraName/CameraPath), then implemented and re-ran to green.

Review in cubic

Camera.main can resolve to a different GameObject than the one an
agent expects when a scene has multiple MainCamera-tagged cameras.
A round5 dogfooding session hit exactly this: raycast kept reporting
"No physics hit" and there was no way to tell which camera the ray
had actually been cast from.

- Add CameraName/CameraPath to RaycastResponse, populated from the
  same Camera.main GameViewRaycastUtility already resolves
- Thread the resolved Camera through GameViewRaycastResult so
  RaycastTool can report it on both the hit and no-hit paths (a
  no-hit response needs the camera identity just as much as a hit
  does, since that's the case round5 actually got stuck on)
- Extend RaycastToolTests to cover both paths
@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 3e0d161d-ca34-4c4a-9265-25eaf3ebd977

📥 Commits

Reviewing files that changed from the base of the PR and between cc74f90 and d9624a3.

📒 Files selected for processing (4)
  • Assets/Tests/Editor/RaycastToolTests.cs
  • Packages/src/Editor/FirstPartyTools/Common/GameView/GameViewRaycastUtility.cs
  • Packages/src/Editor/FirstPartyTools/Raycast/RaycastResponse.cs
  • Packages/src/Editor/FirstPartyTools/Raycast/RaycastTool.cs

📝 Walkthrough

Walkthrough

The raycast pipeline now retains the resolved camera and returns its name and hierarchy path for both collider hits and misses. Editor tests verify camera metadata alongside hit results.

Changes

Raycast camera metadata

Layer / File(s) Summary
Propagate resolved camera through raycast results
Packages/src/Editor/FirstPartyTools/Common/GameView/GameViewRaycastUtility.cs
GameViewRaycastResult stores the resolved camera, and both camera-found and camera-missing paths pass the camera value through its constructor.
Expose and validate camera metadata
Packages/src/Editor/FirstPartyTools/Raycast/RaycastResponse.cs, Packages/src/Editor/FirstPartyTools/Raycast/RaycastTool.cs, Assets/Tests/Editor/RaycastToolTests.cs
RaycastResponse exposes CameraName and CameraPath; RaycastTool populates them for hit and no-hit results, with tests covering both cases.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/raycast-resolved-camera

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@hatayama
hatayama merged commit 2b68047 into feature/pause-point-round5-integration Jul 21, 2026
1 of 2 checks passed
@hatayama
hatayama deleted the feat/raycast-resolved-camera branch July 21, 2026 03:11
@hatayama

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant