Skip to content

Navigation

This plugin allows navigating between 3d views with interactive nodes inside the 3d view.

  • Plugin name: "navigation"
  • Plugin namespace: "navigation"

Dependencies

This plugin has no dependencies.

Loading the plugin

var input_options = {
    container: "container-id",
    plugins: ["navigation"]
};

DVM.loadModule("3d_viewer", input_options)
    .then(function(viewer3d) {
        start(viewer3d);
    })
    .catch(function(err) {
        console.error(err);
    });

function start(viewer3d) {
    // ...
}

If this plugin is loaded, the module will have the following additional features:

Callbacks

This plugin adds the following new callback triggers, additionally to the default ones:

  • click_navigation_node: Will be called when the user clicks a navigation node. The first parameter will be a default callback object with an additional property called navigation with the following content:
    • venue_id (string): venue id of the navigation node view.
    • view_id (string): view id of the navigation node view.
    • reset_camera_rotation (boolean): its value will be false, so the camera rotation is preserved, as is described in loadView3d.

This object is useful for use with loadView3d directly.

1
2
3
4
5
6
7
8
viewer3d.subscribe("click_navigation_node", function(obj) {
    var nav = obj.navigation;
    if (nav) {
        viewer3d.loadView3d(nav)
            .then(...)
            .catch(...);
    }
});

Example

Code

var input_options = {
    container: "viewer3d-container",
    plugins: ["navigation"]
};

DVM.loadModule("3d_viewer", input_options)
    .then(function(viewer3d) {
        start(viewer3d);

    })
    .catch(function(err) {
        console.error(err);
    });

function start(viewer3d) {
    viewer3d.subscribe("click_navigation_node", function(obj) {
        load(obj.navigation);
    });

    load({ venue_id: "eu-es-00040-realmadrid", view_id: "S_SalaVipFelipeII(INT)" });

    function load(load_options) {
    // Load the 3D VIEW
    viewer3d.loadView3d(load_options)
        .then(function(obj) {
            // Successfully loaded
            console.log("LOADED!");
        })
        .catch(function(err) {
            // Error while loading
            console.error(err);
        });
    }
}