update method

dynamic update()

Implementation

update() {
  light.updateMatrixWorld(false);

  double coneLength = light.distance ?? 1000;
  var coneWidth = coneLength * Math.tan(light.angle!);

  cone.scale.set(coneWidth, coneWidth, coneLength);

  _SpotLightHelpervector.setFromMatrixPosition(
      light.target!.matrixWorld);

  cone.lookAt(_SpotLightHelpervector);

  if (color != null) {
    cone.material.color.copy(color);
  } else {
    cone.material.color.copy(light.color);
  }
}