Guest User

Untitled

a guest
Jan 10th, 2018
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. public string grabButton;
  2. public GameObject handModel;
  3. public bool canClimb = false;
  4. public bool isClimbing = false;
  5. private bool holding;
  6.  
  7.  
  8. void FixedUpdate()
  9. {
  10. if (!holding && Input.GetAxisRaw(grabButton) > 0)
  11. {
  12. Pickup();
  13. }
  14.  
  15. if (holding && Input.GetAxis(grabButton) < 1 || isSolid == true && Input.GetAxis(grabButton) < 1)
  16. {
  17. Drop();
  18. }
  19.  
  20. if (!holding && Input.GetAxisRaw(grabButton) > 0 && canClimb == true)
  21. {
  22. player.transform.position += (prevPos - handModel.transform.localPosition);
  23. isClimbing = true;
  24. player.GetComponent<CharacterController>().enabled = false;
  25. }
  26. else
  27. {
  28. isClimbing = false;
  29. player.GetComponent<CharacterController>().enabled = true;
  30. }
  31.  
  32. prevPos = handModel.transform.localPosition;
  33.  
  34.  
  35.  
  36. }
Add Comment
Please, Sign In to add comment