a_scene: a_scene

Description Usage Arguments Details Value

View source: R/scene.R

Description

Create an A-Frame Scene

Usage

1
2
3
4
5
a_scene(.template = "basic_map",
  .title = "A-Frame VR scene created with r2vr", .description = .title,
  .aframe_version = "0.8.2", .js_sources = NULL, .children = NULL,
  .websocket = FALSE, .websocket_host = "localhost",
  .websocket_port = 8080, ...)

Arguments

.template

A name of a built in template or a path to a custom html template.

.title

Title of the scene passed into the HTML

.description

meta description of the scene passed into the HTML

.aframe_version

The version of A-Frame to serve the scene with, defaults to 0.8.2

.js_sources

a character vector of javascript scources to be added to scene html. Local sources will be served remote sources will not.

.children

a list of child A-Frame entities of this scene.

.websocket

TRUE if this scene should try to connect to its server with a websocket connection when served. This can be used to pass messages containing aframe events or entity updates from R to VR.

.websocket_host

The host for the websocket in the client's browser to connect to (IP of r2vr sever).

.websocket_port

The port for the websocket in the client's browser to connect to on the host.

...

components to be added to the scene.

Details

This function creates an object that represents an A-Frame scene. A scene is a special type of A-Frame entity that is the root entity of the WebVR scene. Like regular entities it can have components added to it that change its behaviour.

A scene has a html representation that is based off a template supplied in the 'template' argument. The template is a partially filled out A-Frame html that contains some Javascript js_sources, and potentially some convenient entities. Included templates are: * 'basic' Scene which is empty but for a 10m x 10m grid for ground. Default lights are injected by A-Frame. * 'basic_map' As per basic but camera position starts higher, and WASD movement controls are added. A bright light is situated high in the sky. * 'empty' an empty scene. Default lights are injected by A-Frame. The built-in templates are intended for debugging/construction purposes. Use 'empty' for real scenes or build your own template.

A scene can render itself and all its child entities and assets to a single html file that defines a WebVR scene that can be viewed in a browser. In addition to this a scene can also be called upon to serve itself so that it can be viewed immediately.

Scene components are expressed as ... arguments passed to this function.

Child entities are passed as list in the 'children' argument.

Value

An R6 object representing an A-Frame scene.


MilesMcBain/r2vr documentation built on Dec. 8, 2018, 10:13 a.m.