Advertisement
Guest User

Untitled

a guest
Dec 10th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. float turnTorque = 0;
  2.  
  3. Vector3 euler = transform.eulerAngles;
  4. euler.z = Mathf.Lerp(euler.z, -Input.GetAxis("Horizontal") * rollAngle, 1 );
  5.  
  6. euler.x = Mathf.Lerp(euler.x, Input.GetAxis("Vertical") * rollAngle, 1);
  7. Quaternion addpitch = Quaternion.Euler(euler);
  8. transform.rotation = Quaternion.Lerp(transform.rotation, addpitch, 0.01f);
  9.  
  10. Quaternion addRot = Quaternion.Euler(euler);
  11.  
  12. transform.rotation = Quaternion.Lerp(transform.rotation, addRot, 0.08f);
  13.  
  14. transform.Rotate(new Vector3(Input.GetAxis("Vertical") * pitchSpeed, 0, 0));
  15.  
  16. turnTorque = turnSpeed * Input.GetAxis("Horizontal");
  17. rigbody.AddTorque(Vector3.up * turnTorque);
  18. rigbody.angularDrag = (turnTorque == 0) ? 10 : 3;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement