Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public string grabButton;
- public GameObject handModel;
- public bool canClimb = false;
- public bool isClimbing = false;
- private bool holding;
- void FixedUpdate()
- {
- if (!holding && Input.GetAxisRaw(grabButton) > 0)
- {
- Pickup();
- }
- if (holding && Input.GetAxis(grabButton) < 1 || isSolid == true && Input.GetAxis(grabButton) < 1)
- {
- Drop();
- }
- if (!holding && Input.GetAxisRaw(grabButton) > 0 && canClimb == true)
- {
- player.transform.position += (prevPos - handModel.transform.localPosition);
- isClimbing = true;
- player.GetComponent<CharacterController>().enabled = false;
- }
- else
- {
- isClimbing = false;
- player.GetComponent<CharacterController>().enabled = true;
- }
- prevPos = handModel.transform.localPosition;
- }
Add Comment
Please, Sign In to add comment