Guest User

Untitled

a guest
Jun 23rd, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var maxV : float = 10.0;
  2. var cSpeed : float =0;
  3.  
  4. function FixedUpdate()
  5. {
  6.     var rg = rigidbody;
  7.     if (rg.velocity.x > maxV)
  8.     {
  9.         print("baaaaaaaaaa");
  10.         rg.velocity = new Vector3(maxV,         // X
  11.                   rg.velocity.y,    // Y
  12.                   rg.velocity.z     // Z
  13.                  );
  14.  
  15.     // OR - to avoid having to set the others you should be able to
  16.     //      set individual components of a Vector3 like this;
  17.     rg.velocity.x = maxV;
  18.     }
  19.     cSpeed = Vector3.Magnitude(rg.velocity);
  20. }
Add Comment
Please, Sign In to add comment