I used the react-vr init App
to spin up a sample project and had no problem generating spheres throughout my scene using:
{
data.map(node => return <Sphere key={`node-${node.id}`} radius={1} widthSegments={8} heightSegments={8} lit={true}
style={{color: "red", transform: [{translate: [node.x, node.y, node.z]}]
}}/>
}
But now I am looking to connect the Spheres via a simple Line
geometry. I tried doing the below to create the line, but I don't know how to add to the scene. In plain three.js code I would simply scene.add()
, but I'm not sure how that works in react-vr.
import {
LineBasicMaterial,
Line,
Geometry,
Vector3
} from 'three';
const lineMaterial = new LineBasicMaterial({color: 0xf0f0f0, transparent: true});
lineMaterial.opacity = .75;
const line = new Line(new Geometry(), lineMaterial);
line.geometry.vertices = [new Vector3(0, 0, 0), new Vector3(0, 0, 0)];
line.renderOrder = 10;