three.js - How do you connect a geometry to two moving vertices -
i have created box geometries in threejs app , have drawn cylinder center of 1 center of using code below:
function cylindermesh(pointx, pointy, material) { var direction = new three.vector3().subvectors(pointy, pointx); var orientation = new three.matrix4(); orientation.lookat(pointx, pointy, new three.object3d().up); orientation.multiply(new three.matrix4(1, 0, 0, 0, 0, 0, 1, 0, 0, -1, 0, 0, 0, 0, 0, 1)); var edgegeometry = new three.cylindergeometry(2, 2, direction.length(), 8, 1); var edge = new three.mesh(edgegeometry, material); edge.applymatrix(orientation); edge.position.x = (pointy.x + pointx.x) / 2; edge.position.y = (pointy.y + pointx.y) / 2; edge.position.z = (pointy.z + pointx.z) / 2; return edge; } scene.add(cylindermesh(vertex1, vertex2, globalmaterial));
my question is: how keep cylinder "connected" 2 vertices provide if move?
i don't want use three.line
because can't control width of line , have noticed weird issues clipping if camera gets close.
any ideas?
Comments
Post a Comment