BezierPath, an easy to use and optimized spline path module for TD games and general paths

Bezierpath V2.0.0 is out!

Completely reformatted the code.
Added 1 new function (VisualizePath)
Fixed edge cases
improved construction times
New optional curve size table for .new
decreased memory cost significantly

Github:

5 Likes

Yayyy good job. Path visualize is really useful thx! Can u give some performance stats of comparing bez path v1 and bez path v2

Is there a way to get current node/path with with calc?
I tried use CalculateDerivative but it didnā€™t go well.

sadly no as there wasnā€™t really a clean way to implement it into bezierpath.
though if you are interested you can make the private function ā€œGetSectionFromTā€ public and use it for your needs. it returns the section that corresponds to the inputted T value which hopefully you can use for what you need. a section has full type checking so understanding how they are structured should be a bit easier

1 Like

Ty, i got it working now by copy and modify GetSectionFromT.

1 Like

So pro :sunglasses:
But how can I use this with QuickList?

Can we get some stats on this?

what is TD short for? Tower Defense?

Yes, TD stands for Tower Defense

Also, is this published to Wally yet?

I think it is, if you check the github, it says
"BezierPath can be installed using wally: "

No itā€™s just that ipthe updated version isnā€™t on wally

Hey. I have a question regarding this.
For my formula I use GetServerTimeNow(). You use tick().

Is tick() really that important for the functioning of the system because my code doesnā€™t support speed change currently:

local t = (workspace:GetServerTimeNow() - enemyTable.StartTime) / (totalTime) --workspace:GetServerTimeNow()
				enemyTable.T += t
				enemyTable.StartTime = workspace:GetServerTimeNow()

ā€œStartTimeā€ is basically just serverTimeNow but multiplied with something to support delay. Nothing crazy.

1 Like

it isnā€™t?
im pretty sure i published it

1 section in the new version takes 56 bytes, while in the old it was variable and could easily take up a few hundred or even thousand bytes if a section was long enough due to the precomputation

Whatever, I just copy and pasted it.

Is it possible to create flight paths with bezier path?

Like letā€™s say you want to create a grenade and want to make its flightpath be a smooth curve. Is that possible withe bezier using only 3 nodes? (Start, pull point, end)

1 Like

for that iā€™d recommend just using a regular bezier curve instead of bezier path :slight_smile:

2 Likes

Hi I have been playing around with the CalculateClosestPoint is there any way for me to get the point in much finer time? It was only giving me points of 0.1 in each point how can I increase itā€™s points?

Actually nevermind lol I found a way.

CalculateClosestPoint has an optional iteration parameter but hasnā€™t been implemented.

1 Like

oops, the iteration parameter was from an old version that i forgot to remove haha.
if you want more finer precision you can go into the source code and increase the samples taken by the function. however just a heads up this can be more computationally expensive so make sure to find a good balance.

1 Like