Guest User

Untitled

a guest
May 10th, 2015
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.49 KB | None | 0 0
  1.     void FixedUpdate ()
  2.     {
  3.         horizontalMoving = Input.GetAxis("Horizontal");
  4.         verticalMoving = Input.GetAxis("Vertical");
  5.        
  6.         Vector3 movement = new Vector3 (horizontalMoving, 0.0f, verticalMoving);
  7.         rb.velocity = movement * speed;
  8.        
  9.         rb.position = new Vector3
  10.             (
  11.                 Mathf.Clamp(rb.position.x, boundary.xMin, boundary.xMax),
  12.                 0.0f,  
  13.                 Mathf.Clamp(rb.position.z, boundary.zMin, boundary.zMax)
  14.             );
  15.        
  16.         rb.rotation = Quaternion.Euler (0.0f, 0.0f, rb.velocity.x * -tilt);
  17.     }
Advertisement
Add Comment
Please, Sign In to add comment