Skip to content

Add ability to auto-start VR - #840

Merged
ice1080 merged 7 commits into
mainfrom
auto-start-vr
Aug 13, 2026
Merged

Add ability to auto-start VR#840
ice1080 merged 7 commits into
mainfrom
auto-start-vr

Conversation

@ice1080

@ice1080 ice1080 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Some use cases might make more sense to have an app auto transition from whatever the app is doing into an immersive VR session, rather than having the user click the VR button once the model is visible.
Add this as a prop that can be modified by the parent to turn VR on/off, or set to true by the parent to mount it in VR already.

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com


Stack created with GitHub Stacks CLIGive Feedback 💬

@github-actions github-actions Bot added the patch label Aug 12, 2026
@github-actions

Copy link
Copy Markdown
Contributor

To increment version on merge, please add one of patch (default), minor, or major label to this PR.

ice1080 and others added 6 commits August 12, 2026 13:58
Requests a VR session on the prop's rising edge, so a consuming app can drive
entry from its own control instead of the VR button SplatControls draws in the
canvas. Edge-triggered rather than enforced, so ending a session doesn't pull
the user back into one.

Browsers only grant an immersive session inside a user gesture, which the
viewer cannot manufacture, so the AutoStartVr story raises the request from a
button of its own rather than setting the prop on mount.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
useXr seeded its availability state to false and only filled it in from the XR
manager inside an effect. A state update made in one effect can't reach the
closure of another effect already scheduled in the same commit, so a caller
acting on mount was always told VR was unsupported, whatever the headset
reported. That left autoStartVr unable to start a session on mount, which is
the one moment it exists to cover.

Also adds an onXrError prop, since the console isn't reachable from inside a
headset, which is where these failures happen.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The auto-start story exists to exercise entering VR on mount, so returning from
a session to a viewer running on the desktop left it in a state it never set out
to show. It now returns to the button that starts one.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The story detected this for itself with a component mounted alongside the
viewer, since the XR manager is only reachable from inside the PlayCanvas
application. Reporting it from the viewer drops that component, and gives a
consuming app the counterpart to autoStartVr: something has to tell a caller
that drives entry when the user left, and useXr isn't publicly exported.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Storybook generates an action spy for every on[A-Z] prop and passes it in
through args, which the story spread over its own props, so the callback it
passed was replaced by one that logs to the Actions panel. Spreading args first
leaves the story's own wiring intact.

Folds onXrError into onXrExit, which now carries an optional error. A caller's
answer to a session ending and to one failing to start is usually the same, and
telling the story about a failure the same way it hears about an exit means a
failed start no longer strands a mounted viewer outside XR.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@ice1080
ice1080 marked this pull request as ready for review August 12, 2026 21:40
@ice1080
ice1080 requested a review from a team as a code owner August 12, 2026 21:40

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 43df69f11c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/components/VirtualWalkthrough/VirtualWalkthroughViewer.tsx
@ice1080
ice1080 merged commit ba8839e into main Aug 13, 2026
1 check passed
@ice1080
ice1080 deleted the auto-start-vr branch August 13, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants