Log inGet started
World

Builtin Library

Branchmain
Branchesmainpublish
Commite8beb5604c

README.md

points.cone (procNode)

Points in a cone opening from an apex along a direction, each carrying N: its own direction out of the apex, spread evenly within the cone's angle. With no length every point sits at the apex. Use it for sprays, muzzle flashes and fountains, where N becomes a velocity.

The direction is drawn evenly over the spherical cap the angle bounds: ct = 1 - draw0 * (1 - cos(angle)), then an angle around the axis from draw 1, and the distance from the apex is length * draw2 ^ (1/3). The draws are channels 0 to 2 of the emit scope.

Built from: rand.unit, points.axis_basis, core.points, math.*.

Inputs

  • count (Float, default 256, at least 0). How many points. Each is drawn on its own, so raising this fills the same shape denser without moving the points already there.
  • seed (Float, default 1). Which of the possible layouts this is; the same seed draws the same points on every run and platform.
  • center (Vec3, default (0, 0, 0)). The apex the cone opens from.
  • direction (Vec3, default (0, 1, 0)). The cone's axis.
  • angle (Float, default 25, 0 to 180). The half-angle between the axis and the cone's side, in degrees: 0 is a line, 90 a hemisphere, 180 every direction.
  • length (Float, default 0, at least 0). How far from the apex the points fill, evenly by volume. 0 puts every point at the apex.

Outputs

  • points (Points). count points carrying P, N (unit) and id.
local spray = g.points.cone({ count = 100, direction = vector.create(1, 0, 0), angle = 30, length = 2 })