ArrowHelper constructor
ArrowHelper(
- dynamic dir,
- dynamic origin,
- dynamic length,
- dynamic color,
- dynamic headLength,
- dynamic headWidth,
Implementation
ArrowHelper(dir, origin, length, color, headLength, headWidth) : super() {
// dir is assumed to be normalized
type = 'ArrowHelper';
dir ??= Vector3(0, 0, 1);
origin ??= Vector3(0, 0, 0);
length ??= 1;
color ??= 0xffff00;
headLength ??= 0.2 * length;
headWidth ??= 0.2 * headLength;
if (_lineGeometry == null) {
_lineGeometry = BufferGeometry();
_lineGeometry.setAttribute('position', Float32BufferAttribute(Float32Array.from([0, 0, 0, 0, 1, 0]), 3, false));
_coneGeometry = CylinderGeometry(0, 0.5, 1, 5, 1);
_coneGeometry.translate(0, -0.5, 0);
}
position.copy(origin);
line = Line(_lineGeometry, LineBasicMaterial({"color": color, "toneMapped": false}));
line.matrixAutoUpdate = false;
add(line);
cone = Mesh(_coneGeometry, MeshBasicMaterial({"color": color, "toneMapped": false}));
cone.matrixAutoUpdate = false;
add(cone);
setDirection(dir);
setLength(length, headLength, headWidth);
}