Advertisement
mew_fi

Airmove

Jan 15th, 2016
922
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. // AIRMOVE STUFF
  2.     void CalculateDrag(Vector3 direction, Vector3 velocity) {
  3.         dotP = Vector3.Dot(velocity.normalized, direction);
  4.         if (dotP < 0) {
  5.             dotP *= -1;
  6.             drag = dotP * dragMulti * (1 - dotP * 0.9f);
  7.             direction = direction + velocity.normalized * 0.1f;
  8.             body.AddForce(direction * drag * Time.deltaTime, ForceMode.Acceleration);
  9.         }
  10.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement