I’d like to be able to draw a triangle by supplying the (x,y,z) coordinates for each vertex. This was asked on StackOverflow a while ago, but the answer no longer works since it relies on the now deprecated
A new answer was added in August of this year, which leveraged
THREE.Shape and drew some lines to each point, but this doesn’t let me set the z-coordinate of each vertex.
What’s the best way to draw a triangle that allows the user to specify the full (x,y,z) coordinate of each vertex?
See from the Collection of examples from discourse.threejs.org
addAttribute is now setAttribute
This dynamic example clearly shows the place where you can set the coordinates arbitrarily.
// --- calculate here the coordinates according to your wishes ---
x = j / 10 - 2;
y = c * Math.sin( 2 * Math.PI * j / 100 + t );
z = i ;