UArNode.line constructor
UArNode.line({
- required String id,
- required UArVector3 from,
- required UArVector3 to,
- double thickness = 0.004,
- Color color = const Color(0xFFFFFFFF),
- String? anchorId,
- bool renderOnTop = false,
A thin bar between two points, e.g. a measuring line.
Implementation
factory UArNode.line({
required String id,
required UArVector3 from,
required UArVector3 to,
double thickness = 0.004,
Color color = const Color(0xFFFFFFFF),
String? anchorId,
bool renderOnTop = false,
}) {
final UArVector3 delta = to - from;
final double length = delta.length;
final UArQuaternion rotation = length < 1e-6 ? UArQuaternion.identity : UArQuaternion.lookRotation(delta);
return UArNode(
id: id,
type: UArNodeType.box,
width: thickness,
height: thickness,
depth: length,
position: from.lerp(to, 0.5),
rotation: rotation,
anchorId: anchorId,
material: UArMaterial(color: color, unlit: true, renderOnTop: renderOnTop),
castShadow: false,
hittable: false,
);
}