PcoWSkbVqDnWTu_dm2ix
We use cookies on this site to enhance your user experience
Collapse Sidebar

CurveSize0

Beam

float

Determines, along with Beam/Attachment0 the position of the first control point in the Beam’s Bézier curve.

The position of this point can be determined by the following equation:

local controlPoint1 = Beam.Attachment0.WorldPosition + (Beam.Attachment0.CFrame.rightVector * Beam.CurveSize0)

Beam Curvature

Beams are configured to use a cubic Bézier curve. This means they are not constrained to straight lines, and the curve of the beam can be modified by changing CurveSize0, Beam/CurveSize1 and the orientation of the beam’s Attachments.

Cubic Bézier curves are formed of four control points. They are determined as follows:

  • P0: The start of the beam, the position of Beam/Attachment0
  • P1: CurveSize0 studs away from Beam/Attachment0, in Beam/Attachment0's positive X direction.
  • P2: Beam/CurveSize1 studs away from Beam/Attachment1, in Beam/Attachment1's negative X direction.
  • P3: The end of the beam, the position of Beam/Attachment1

The beam starts at P0, goes towards P1, and arrives at P3, from the direction of P2. The beam will not necessarily pass through P1 and P2.

See the images below for a visual demonstration.

BeamCurve1
BeamCurve2


Code Samples


Creating a Beam From Scratch

​This code sample demonstrates how a Beam effect can be created from scratch by creating a Beam, setting all of its properties and configuring it’s Attachments. See below for an image of the final result:

enter image description here