Closed OttoHatt closed 2 months ago
Looking at this again, it might be better to implement this as some kind of iterator, as precomputing all at once is expensive and not good for animations. Like, you'd call a method (say CreateUniformMinFrameIterator
) and it'd return a function that you call with a 't' value.
local iter = CatRom:CreateUniformMinFrameIterator()
local pointA = iter(0) -- The first call would become the reference point.
local pointB = iter(0.1)
local pointC = iter(0.2)
...
I was flipping the lookVectors in the creation of CFrame.new, which broke the transform and creates weird inversions. lookVectors are now correct, but backwards, so I think it'd be best to :Inverse() all CFrame points, even though this'd make the up/right vectors technically incorrect?
Broken for straight lines! Check the code comments. Please also double check the maths, as I don't think it's 100% perfect. Optimizations could be done (i.e. removing local functions), but for now I focused on readability.