Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. void OnControllerColliderHit(ControllerColliderHit hit)
  2. {
  3. Rigidbody body = hit.collider.attachedRigidbody;
  4.  
  5. if (body == null || body.isKinematic)
  6. return;
  7.  
  8. if (hit.moveDirection.y < -.3f)
  9. return;
  10.  
  11. Vector3 pushDirection = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z);
  12. body.velocity = pushForce * pushDirection;
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement