Advertisement
Miziziziz

rigidbody charcontroller

Sep 17th, 2016
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. //if you wanted to use a rigidbody
  2. //if (x > 0.001f || x < -0.001f || z > 0.001f || z < -0.001f)
  3. //{
  4. // //move force
  5. // Vector3 moveVector = new Vector3(x, 0, z);
  6. // if (moveVector.magnitude > 1) //prevent diagonal super running
  7. // moveVector = moveVector.normalized;
  8.  
  9. // moveVector *= playerAccelForce;
  10. // moveVector = _transform.TransformDirection(moveVector);
  11. // //drag force
  12. // float movingDragForce = playerAccelForce / maxSpeed;
  13. // Vector3 dragVector = controller.velocity * movingDragForce;
  14. // dragVector.y = 0;
  15.  
  16. // controller.AddForce(moveVector - dragVector);
  17. //}
  18. //else
  19. //{
  20. // Vector3 dragVector = -controller.velocity * stoppingDragForce;
  21. // dragVector.y = 0;
  22. // controller.AddForce(dragVector);
  23. //}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement