BezierPath is an easy to use bezier spline module, designed to be used for TD games and general paths while being optimizied for large scale uses.
Code example
local BezierPath = "Path to the module"
local Positions = {
Vector3.new(0,10,0),
Vector3.new(10,0,0),
Vector3.new(10,10,10)
}
local NewPath = BezierPath.new(Positions,3)
local Part = Instance.new("Part",workspace)
Part.Size = Vector3.new(1,1,1)
Part.Anchored = true
for t = 0,1,1/100 do
Part.CFrame = NewPath:CalculateUniformCFrame(t)
task.wait(0.1)
end
Optimization
Here is BezierPath against the old module i used for my TD game calculating uniform positions
this module probably wouldn’t be the best option, id recommend catrom for cutscenes as its alot more smooth. unless you want to use this module’s behavior for cutscenes
I’m pretty sure this is already possible, the T in uniform CFrame/Position methods is an alpha value. If you give it the value of 0.5 it will be in the middle of the path.
You can easily translate a distance value to a T value. In the module i made a function called :GetPathLength()
it returns the splines total length. With this you can easily get the needed T value by just doing local T = Distance / PathLength
omrez, i am truly thankful for this amazing module bestowed unto me by the powers of total, peak roblox programming, in which leaves me bewildered as its beyond my puny understanding
Question, I might be dumb or so or I just can’t happen to be able to set it up right but for some reason it error that “new” is not a valid member of the module… Should not happen since .new() is literally a function in the module.