Doc > Nodes > SOP > File

Doc > Nodes > SOP > File

Loads a geometry from a url.

Description

Note that this node will automatically use a specific loader depending on the extension of the url.

Parameters

Name Type Description
url string url to load the geometry from
format string format
reload button reload the geometry

Edit code in JsFiddle , Codepen , view in a new tab or Open in the Editor


// create a scene
const scene = new PolyScene();
const root = scene.root();

// create a file node
const geo = root.createNode('geo');
const file = geo.createNode('file');
file.p.url.set('https://raw.githubusercontent.com/polygonjs/polygonjs-assets/master/models/wolf.obj');

// add a light
root.createNode('hemisphereLight');

// create a camera
const perspectiveCamera1 = root.createNode('perspectiveCamera');
perspectiveCamera1.p.t.set([5, 5, 5]);
// add orbitControls
const events1 = perspectiveCamera1.createNode('eventsNetwork');
const orbitsControls = events1.createNode('cameraOrbitControls');
perspectiveCamera1.p.controls.setNode(orbitsControls);

// mount the viewer
const element = document.getElementById('app');
perspectiveCamera1.createViewer(element);