TouchEdge.js 670 B

123456789101112131415161718192021222324
  1. import * as THREE from "three";
  2. import { Line2 } from "three/examples/jsm/lines/Line2.js";
  3. import { LineGeometry } from "three/examples/jsm/lines/LineGeometry.js";
  4. export default class TouchEdge extends THREE.Group {
  5. constructor(positions, matLine) {
  6. super();
  7. positions.forEach((i, j) => {
  8. //top left bottom right
  9. const geometry = new LineGeometry();
  10. geometry.setPositions(i);
  11. const line = new Line2(geometry, matLine);
  12. line.scale.set(1, 1, 1);
  13. line.position.y += 0.5;
  14. line.name = j;
  15. line.visible = false;
  16. line.x = i[0];
  17. line.y = i[2];
  18. this.add(line);
  19. });
  20. // console.log(this);
  21. }
  22. }