javascript - How to rotate THREE.TubeGeometry segments? -


i've created flat three.tubegeometry radiussegments = 2, when added scene perpendicular ground:

enter image description here

is possible rotate each tube segment parallel ground?

jsfiddle example.

var points = []; (var = 0; < 5; i++) {    var randomy = i*5/2*10 + -50;    var randomx = 15*math.sin(5*i);    points.push(new three.vector3(randomx, randomy, 0)); } var tubegeometry = new three.tubegeometry(new three.splinecurve3(points), 64, 6, 2, false); tubemesh = createmesh(tubegeometry); scene.add(tubemesh); 

my recommendation use custom flat geometry (not tubegeometry!) , calculate vertices want them (not rotate!).

methodology geometry like:

  1. create random points (here math needed in order have them want them be, funny part!)
  2. get spline points each curve
  3. triangulate on them

if decide go forward code here change have parallel plane. add generatetube function, after tubemesh creation:

tubemesh.rotatey(math.pi/2); 

Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -