These docs are for v1.2. Click to read the latest docs for v2-beta.x.

Line component is generated from a curve/line and amount of vectors that should be used (points).

const line = new WHS.Line({
  geometry: {
    curve: new THREE.LineCurve3(new THREE.Vector3(10, 10, 0), new THREE.Vector3(10, 30, 0))
  },

  softbody: true
});

line.addTo(GAME);

Usage as a rope (softbody:true):

const rope1 = new WHS.Line({
  geometry: {
    curve: new THREE.LineCurve3(new THREE.Vector3(10, 10, 0), new THREE.Vector3(10, 30, 0))
  },

  physics: {
    piterations: 10,
    viterations: 10
  },

  mass: 1,

  softbody: true
});

rope1.addTo(GAME);

rope1.appendAnchor(GAME, toptube, 50, 1);

Parameters

Geometry defaults

{
  // ...

  geometry: {
    curve: false, // Boolean
    points: 50 // Number
  }
}

These defaults are additional, there are also defaults filled by MeshComponent, etc.

Instructions

{
  // ...

  geometry: ['curve', 'points']
}