Adds points or creates lines.
Description
The add node can be used to add a single or multiple points.
If given points as input, it can also connect those points with a line.
Parameters
Name |
Type |
Description |
createPoint |
boolean |
toggle to create points |
pointsCount |
integer |
define the number of points to create |
position |
vector3 |
the position of the created points |
connectInputPoints |
boolean |
toggle on to connect the points from the input geometry |
connectToLastPoint |
boolean |
check if the last point is connected |
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 an add node
const geo = root.createNode('geo');
const add = geo.createNode('add');
// let's add a material so we can actually see the point
const materials = root.createNode('materialsNetwork');
const points = materials.createNode('points');
points.p.color.set([0, 0, 1]);
// assign the material
const material = geo.createNode('material');
material.setInput(0, add);
material.p.material.setNode(points);
material.flags.display.set(true);
// 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});