Doc > Nodes > SOP > Box

Doc > Nodes > SOP > Box

Creates a box.

Description

If the node has no input, you can control the radius and center of the box. If the node has an input, it will create a box that encompasses the input geometry.

Parameters

Name Type Description
size float size of the box
divisions integer number of segments on each axis
center vector3 center of 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 box
const geo = root.createNode('geo');
const box = geo.createNode('box');

// 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);