duck

Untitled

Jan 28th, 2011
204
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.37 KB | None | 0 0
  1.     public float pushPower = 2.0F;
  2.     void OnControllerColliderHit(ControllerColliderHit hit) {
  3.         Rigidbody body = hit.collider.attachedRigidbody;
  4.         if (body == null || body.isKinematic)
  5.             return;
  6.        
  7.         //if (hit.moveDirection.y < -0.3F)
  8.         //  return;
  9.        
  10.         Vector3 pushDir = new Vector3(hit.moveDirection.x, 0, hit.moveDirection.z);
  11.         body.velocity = pushDir * pushPower;
  12.     }
Advertisement
Add Comment
Please, Sign In to add comment