Smooth array values

I made my own air navigation system that works by generating a array of Vector3 positions, and then I move the drone to the position 0,1,2…

The problem is that the drone makes sharp 90 degree turns, so i want to make a curve instead of the sharp turn, but no idea how to do it. Any help?

See below for a general purpose way to smoothly change values, such as position and heading.

What you probably want is to smoothly move the position, obviously.

Then you could smoothly change the facing to match the movement.

Smoothing movement between any two particular values:

You have currentQuantity and desiredQuantity.

  • only set desiredQuantity
  • the code always moves currentQuantity towards desiredQuantity
  • read currentQuantity for the smoothed value

Works for floats, Vectors, Colors, Quaternions, anything continuous or lerp-able.

The code: SmoothMovement.cs · GitHub

If the drone is fixed-wing and flies continuously (eg, does not stop at each point), the problem is slightly different. You would need to turn in advance to make it to your goal, as well as slow down if (for example) the goal is so close you would just keep orbiting the goal.

Attached is a codelet that steers a steadily-moving missile towards a target.

6041018–652844–MissileTurnTowards.unitypackage (11.3 KB)

My drone flies untill he sees the player. At the moment he moves between position with Vector3.moveTorwards and looks at the next point with transform.LookAt.