-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: avoiding enter xr btn Merge PR #236 from TiborUdvari/feat/user-…
…actionless-init
- Loading branch information
Showing
7 changed files
with
75 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
## Avoiding the Enter XR Button | ||
![Enter XR Button](../assets/docs/enter-ar.png) | ||
|
||
Usually, you must press a button before starting an immersive AR or VR session. This is a security measure to prevent websites from overwhelming users. However, pressing this button each time you want to test a change in your code can be tedious. | ||
|
||
By default, p5.xr `createCanvas` will attempt to launch the session without requiring the button press. If you use the [Immersive Web Emulator](quick-start/emulator.md) or have turned off the webxr-enforce-user-activation flag in your XR device browser, this will work directly. Otherwise, you must click the button to launch the interactive session. | ||
|
||
```javascript | ||
function setup() { | ||
createCanvas(windowWidth, windowHeight, AR); | ||
} | ||
``` | ||
|
||
If you want to see the button while coding, you can launch the session like below. | ||
|
||
```javascript | ||
function setup() { | ||
createCanvas(windowWidth, windowHeight, AR_BUTTON); | ||
} | ||
``` | ||
|
||
To allow sketches to launch directly on your XR device browser, navigate to `chrome://flags/#webxr-enforce-user-activation` and disable that flag. Note that this option may not be available in all browsers. | ||
|
||
![Meta Quest Browser User Activation Flag](../assets/docs/webxr-user-activation.jpg) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,34 @@ | ||
export const LEFT = 'left'; | ||
export const RIGHT = 'right'; | ||
|
||
/** | ||
* One of the four possible values of a an XR session (AR, VR, AR_BUTTON or VR_BUTTON) | ||
* AR and VR attempt to launch the session without user action | ||
* @property {String} AR | ||
* @final | ||
*/ | ||
export const AR = 'AR'; | ||
|
||
/** | ||
* One of the four possible values of a an XR session (AR, VR, AR_BUTTON or VR_BUTTON) | ||
* AR and VR attempt to launch the session without user action | ||
* @property {String} VR | ||
* @final | ||
*/ | ||
export const VR = 'VR'; | ||
|
||
/** | ||
* One of the four possible values of a an XR session (AR, VR, AR_BUTTON or VR_BUTTON) | ||
* AR_BUTTON and VR_BUTTON do not attempt to launch the session without user action | ||
* @property {String} AR_BUTTON | ||
* @final | ||
*/ | ||
export const AR_BUTTON = 'AR_BUTTON'; | ||
|
||
/** | ||
* One of the four possible values of a an XR session (AR, VR, AR_BUTTON or VR_BUTTON) | ||
* AR_BUTTON and VR_BUTTON do not attempt to launch the session without user action | ||
* @property {String} VR_BUTTON | ||
* @final | ||
*/ | ||
export const VR_BUTTON = 'VR_BUTTON'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters