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);
  }
}