|
| 23 Oct 2015 08:04 AM |
| I'm making a path finding system. The path finding already works but I'd like to smooth out the path with quadratic Bézier curves. I don't think that will be a problem, but I'm wondering how to best follow a Bézier curve path with a bot. Any ideas? |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2015 08:06 AM |
| Not too knowledgable on creating those curves but my intuition would be just to assign a numeric number to a part's name every so often. Then have the NPC follow the (spaced out) parts :D |
|
|
| Report Abuse |
|
|
robocu3
|
  |
| Joined: 13 Mar 2009 |
| Total Posts: 6485 |
|
|
| 23 Oct 2015 08:09 AM |
i actually worked with these a little while back i'm kinda curious as to how you intend to do this, though, doesn't it need two points and then a directional point?
-=Robo=- |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2015 08:12 AM |
creating those curves ( look at the animations :3 ) https://en.wikipedia.org/wiki/Bézier_curve#Constructing_B.C3.A9zier_curves
And the Bézier curves will be very close to each other and need to be dynamically created and destroyed (otherwise I would have millions at once of them)
So I don't see my self using spaced out parts or vectors. |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 23 Oct 2015 08:13 AM |
Turn the curve into a set of points you can follow. Have the bot follow the points you set up.
More points == higher resolution == more accurate following == more processing Less points == lower resolution == less accurate following == less processing
Find a good balance between those. |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2015 08:16 AM |
some basic Bézier calculation code:
A = source point B = direction point (bad naming) C = target point t = time (0 to 1)
lerp = A.Lerp
curPoint = lerp(lerp(A, B, t), lerp(B, C, t), t) |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2015 08:18 AM |
@digpoe
But what if the bots are fast enough to reach the point in less then one frame. then the bot will slow down :/ |
|
|
| Report Abuse |
|
|
digpoe
|
  |
| Joined: 02 Nov 2008 |
| Total Posts: 9092 |
|
|
| 23 Oct 2015 08:26 AM |
| well it's pretty much the same way every game does it so idk |
|
|
| Report Abuse |
|
|
|
| 23 Oct 2015 11:39 AM |
| hm... I guess I'll just CFrame move them, wasn't planing on using humanoids anyway. |
|
|
| Report Abuse |
|
|