Advertisement
Guest User

Untitled

a guest
Nov 15th, 2018
274
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1.  
  2. public static Vector2 Parabola(Vector2 start, Vector2 end, float height, float t)
  3. {
  4. Func<float, float> f = x => -4 * height * x * x + 4 * height * x;
  5.  
  6. var mid = Vector2.Lerp(start, end, t);
  7.  
  8. return new Vector2(mid.x, f(t) + Mathf.Lerp(start.y, end.y, t));
  9. }
  10.  
  11. public static Vector2 Parabola(Vector2 start, Vector2 end, float height, float t)
  12. {
  13. Func<float, float> f = x => -4 * height * x * x + 4 * height * x;
  14.  
  15. var mid = Vector2.Lerp(start, end, t);
  16.  
  17. return new Vector2(mid.x, f(t) + Mathf.Lerp(start.y, end.y, t));
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement