src/scripts/Objects/OldCar.js
/**
   * Add car body to group.
   *
   * @param {double} x
   * @param {double} y
   * @param {double} z
   */
Add car body to group.
Add car body to group .
addBody() {
    const body = new Group();
    const frontGeometry = new BoxGeometry(3, 1, 3, 5, 5, 5);
    const backGeometry = new BoxGeometry(3, 2, 3, 5, 5, 5);
    const front = new Mesh(frontGeometry, new MeshLambertMaterial({ color: 0x00ff00, wireframe: true }));
    const back = new Mesh(backGeometry, new MeshLambertMaterial({ color: 0x00ff00, wireframe: true }));
    back.name = 'back';
    back.add(
      this.addWheel(0, -0.5, 2.5),
      this.addWheel(0, -0.5, -2.5),
    );
    front.name = 'front';
    front.position.set(3, -.5, 0);
    front.add(
      this.addWheel(0, 0, 2.5),
      this.addWheel(0, 0, -2.5),
    );
    body.add(front, back, this.createGlass());
    body.rotateY(-Math.PI/2);
    return body;
  }
addBody ( ) { const body = new Group ( ) ; const frontGeometry = new BoxGeometry ( 3 , 1 , 3 , 5 , 5 , 5 ) ; const backGeometry = new BoxGeometry ( 3 , 2 , 3 , 5 , 5 , 5 ) ; const front = new Mesh ( frontGeometry , new MeshLambertMaterial ( { color : 0x00ff00 , wireframe : true } ) ) ; const back = new Mesh ( backGeometry , new MeshLambertMaterial ( { color : 0x00ff00 , wireframe : true } ) ) ; back . name = 'back' ; back . add ( this . addWheel ( 0 , - 0.5 , 2.5 ) , this . addWheel ( 0 , - 0.5 , - 2.5 ) , ) ; front . name = 'front' ; front . position . set ( 3 , - .5 , 0 ) ; front . add ( this . addWheel ( 0 , 0 , 2.5 ) , this . addWheel ( 0 , 0 , - 2.5 ) , ) ; body . add ( front , back , this . createGlass ( ) ) ; body . rotateY ( - Math . PI / 2 ) ; return body ; }
Add car body to group.
Add car body to group .
// Back. // Front.