setLength method

void setLength(
  1. double length, [
  2. double? headLength,
  3. double? headWidth
])

length - The desired length.

headLength - The length of the head of the arrow.

headWidth - The width of the head of the arrow.

Sets the length of the arrowhelper.

Implementation

void setLength(double length, [double? headLength, double? headWidth]) {
  headLength ??= 0.2 * length;
  headWidth ??= 0.2 * headLength;

  line.scale.setValues(1, math.max(0.0001, length - headLength), 1); // see #17458
  line.updateMatrix();

  cone.scale.setValues(headWidth, headLength, headWidth);
  cone.position.y = length.toDouble();
  cone.updateMatrix();
}