ViewRoot

ViewRoot

The view root is created when your Worldcore session starts. It owns all pawns and all view-side services. You can access the view root from anywhere in the view with the global pointer viewRoot.

Extends

Members

# (readonly) time :number

Returns the system time in milliseconds at the last frame update.

Type:
  • number
Inherited From:

# (readonly) delta :number

Returns the time in milliseconds between the last frame update and the previous one.

Type:
  • number
Inherited From:

Methods

# (static) viewServices() → {Array.<ViewService>}

Returns an array of view services that will be created when the session starts. You should overload this in your view root to instantiate only the services you need.

Note: Array entries can be either the name of a service, or an object containing the name or the service plus options to be passed to it when it's instantiated.

Returns:
Type
Array.<ViewService>
Example
static viewServices() {
        return [InputManager, RenderManager, UIManager];
    }

# service(name) → {ViewService}

Returns a pointer to the named view service.

Parameters:
Name Type Description
name string

The public name of the view service.

Inherited From:
Returns:
Type
ViewService

# modelService(name) → {ModelService}

Returns a pointer to the named model service.

Note: The view should only read from the model service. Do not write to it, or call methods that modify it.

Parameters:
Name Type Description
name string

The public name of the model service.

Inherited From:
Returns:
Type
ModelService