Trajectory
Child class of Hitbox. Used for constructing paths that the Hitbox will traverse automatically.
Public
Trajectory.ConstructionMode
Trajectory.ConstructionMode -- string
None
, Linear
or Bezier
Trajectory.Velocity
Trajectory.Velocity -- number
Trajectory:Construct(ConstructionMode: string, Fields: {string: any})
Trajectory:Construct("Linear", {
DirectionalVector = Vector3.new(0.55, -0.02, 0.4),
Velocity = 25
})
Trajectory:Construct("Bezier", {
BezierPoints = {
Start = Vector3.new(),
Control1 = Vector3.new(),
Control2 = Vector3.new() or nil,
End = Vector3.new()
},
Velocity = 25
})
Trajectory:Construct("None")
ConstructionMode
and Fields
as seen above. If BezierPoints.Control2
is nil, the path will become a quadratic bezier curve. Otherwise, the path will become a cubic bezier curve. DirectionalVector
MUST be a normalized. If Velocity
is nil, it will use the previous Velocity. If ConstructionMode
is None
, deconstructs the path instead.
Trajectory:Deconstruct()
Trajectory:Deconstruct()
Trajectory.ConstructionMode
to None
.
Private
Note: Private variables, methods and functions should not be used unless you know what you're doing.
Trajectory._DirectionalVector
Trajectory._DirectionVector -- Vector3 or nil
Trajectory:Construct()
.
Trajectory._Length
Trajectory._Length -- number
ConstructionMode
is Bezier
.
Trajectory._Completion
Trajectory._Completion -- number
ConstructionMode
is Bezier
.
Trajectory._Points
Trajectory._Points --[[ {
Start = Vector3.new(),
Control1 = Vector3.new(),
Control2 = Vector3.new() or nil,
End = Vector3.new()
} --]]
Trajectory:Construct()
.
Trajectory:_GetBezierMode()
local mode = Trajectory:_GetBezierMode() -> string
Quad
or Cubic
based on the bezier formula used.