Help with figuring out math to calculate a curve

You can write your topic however you want, but you need to answer these questions:

  1. What do you want to achieve? Keep it simple and clear!
    i’ve already figured out how to move the npc forward, but i just cant seem to wrap my head around the math required to moving an npc around a corner, btw im not using humanoids, its not what im looking for.

  2. What is the issue? Include screenshots / videos if possible!

its incredibly difficult for me, and way above my level and im also trying to optimize my game as much as possible so i put 1 large node on a corner and then the npc curves through the node, i know this is possible since i’ve seen a twitter post i stumbled across while searching through twitter, the dev (who made that) said he used 1 node on a corner and smoothed it out with “some hacky math” achieve this. Im just looking for guidance, or if possible people who know the forumla/algorithm. (im guessing the dev took the npc position when it reached the point and calculated the position on the other side of the node then connected the 2 points?)

  1. What solutions have you tried so far? Did you look for solutions on the Developer Hub?
    i’ve searched and searched through the devforum and even on websites like stackoverflow but none of them seem to have what im looking for
    Twitter Video Here

Looks like a grid shaped path finding system since the path is blocky.

image

Since the path is all squares at the corners and the entry and exit points are at the center of the path that means the curve is circular.

image

The node Atrazine is probably talking about is labeled as the blue one above and to calculate the position around that point you can use cos and sin to get the position from there.

image

1 Like

Thanks i’ll look into it when i can

so Atrazine used cos and sin to move around the corner? Sorry about the question i’ve just never known about cos and sin.

That could be a possibility, similar to a common orbital motion script:

1 Like

Thanks but im struggling to find a way to combine movement going forward and the curving, what do you think Atrazine did in the video

I’ve been thinking of using spline curves to move forward but i cant seem to find any spline formula that works properly

Edit : I solved it don’t worry

Sorry for late reply, but i’ve been trying to impliment this into my game for a while but it always rotates to a different position when is finishes and since im using nodes it looks bad, did i also mention that the npcs have an offset? I might be missing something but it doesnt work for me

Edit : I found a finished version of Atrazines post turns out its for a tower defense game
https://twitter.com/AtrazineC/status/1520514854238314496?cxt=HHwWgICjqYaN-pkqAAAA