SceneViewerSession
class SceneViewerSession implements ARSession, OptionGetters<SceneViewerSessionOptions>
AR session using Google's scene-viewer
See:
Methods
constructor
new SceneViewerSession(view3D, params, params.file, params.mode, params.fallbackURL, params.title, params.link, params.sound, params.resizable, params.vertical, params.disableOcclusion, params.initialScale, params.shareText)
Create new instance of SceneViewerSession
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
view3D | View3D | Instance of the View3D | ||
params | object | ✔️ | {} | Session params |
params.file | string | ✔️ | This URL specifies the glTF or glb file that should be loaded into Scene Viewer. This should be URL-escaped. If null is given, it will try to use current model shown on the canvas. This behavior only works when the format of the model shown is either "glTF" or "glb". | |
params.mode | string | ✔️ | "ar_only" | See SCENE_VIEWER_MODE for available modes (also check their official page for details). |
params.fallbackURL | string | ✔️ | This is a Google Chrome feature supported only for web-based implementations. When the Google app com.google.android.googlequicksearchbox is not present on the device, this is the URL that Google Chrome navigates to. | |
params.title | string | ✔️ | A name for the model. If present, it will be displayed in the UI. The name will be truncated with ellipses after 60 characters. | |
params.link | string | ✔️ | A URL for an external webpage. If present, a button will be surfaced in the UI that intents to this URL when clicked. | |
params.sound | string | ✔️ | A URL to a looping audio track that is synchronized with the first animation embedded in a glTF file. It should be provided alongside a glTF with an animation of matching length. If present, the sound is looped after the model is loaded. This should be URL-escaped. | |
params.resizable | boolean | ✔️ | true | When set to false, users will not be able to scale the model in the AR experience. Scaling works normally in the 3D experience. |
params.vertical | boolean | ✔️ | false | When set to true, users will be able to place the model on a vertical surface. |
params.disableOcclusion | boolean | ✔️ | false | When set to true, SceneViewer will disable object blending |
params.initialScale | string | ✔️ | "auto" | Initial scale of the 3D model. If set to null , 3D model will shown as its original size and will disable the "View actual size" button. Default value is "auto", and "1" will show model size in 100%, "2" in 200%, "0.5" in 50% and so on. |
params.shareText | string | ✔️ | A text that will be displayed when user clicked the share button. |
Methods
isAvailable
Return the availability of SceneViewerSession.
Scene-viewer is available on all android devices with google ARCore installed.
Returns: Promise
- A Promise that resolves availability of this session(boolean).
enter
Enter Scene-viewer AR session