solidParts property

  1. @override
List<SolidPart> get solidParts
override

The shape as convex parts whose union it is, in its entity's own space (before the entity's scale). Empty for none.

Implementation

@override
List<SolidPart> get solidParts {
  final r = Primitive3D.size(radius), hy = Primitive3D.size(height) / 2;
  final s = Primitive3D.count(segments, 3, 32);
  final points = Float32List((s + 1) * 3);
  for (var i = 0; i < s; i++) {
    final a = 2 * math.pi * i / s;
    points
      ..[i * 3] = r * math.cos(a)
      ..[i * 3 + 1] = hy
      ..[i * 3 + 2] = r * math.sin(a);
  }
  points[s * 3 + 1] = -hy;
  return [SolidHull(points)];
}