private void Update() { canMoveX = Physics.CheckSphere(movePoint.position + new Vector3(Input.GetAxisRaw("Horizontal"), -0.75f, 0f), 0.2f, moveableLayer); canMoveZ = Physics.CheckSphere(movePoint.position + new Vector3(0f, -0.75f, Input.GetAxisRaw("Vertical")), 0.2f, moveableLayer); Collider[] stairsX = Physics.OverlapSphere(movePoint.position + new Vector3(Input.GetAxisRaw("Horizontal"), -0.75f, 0f), 0.2f, stairs); Collider[] stairsZ = Physics.OverlapSphere(movePoint.position + new Vector3(0f, -0.75f, Input.GetAxisRaw("Vertical")), 0.2f, stairs); groundRight = Physics.OverlapSphere(transform.position + new Vector3(1f, 0.75f, 0), 0.2f, ground); //If none of these are true then the player cant use the stairs groundLeft = Physics.OverlapSphere(transform.position + new Vector3(-1f, 0.75f, 0), 0.2f, ground); groundUp = Physics.OverlapSphere(transform.position + new Vector3(0f, 0.75f, 1f), 0.2f, ground); groundDown = Physics.OverlapSphere(transform.position + new Vector3(0f, 0.75f, -1f), 0.2f, ground); currentGround = Physics.OverlapSphere(transform.position + new Vector3(0f, -0.75f, 0f), 0.2f, moveableLayer); if (isControlled) { outliner.CreateOutline(); playerMovement.enabled = false; if (Input.GetKeyDown(playerMovement.interactKey)) { if (!currentGround[0].CompareTag("CantPlace")) { playerMovement.enabled = true; isControlled = false; } } if (Vector3.Distance(transform.position, movePoint.position) <= 0.05f) { if (Mathf.Abs(Input.GetAxisRaw("Horizontal")) == 1) { if (canMoveX) { if (stairsX.Length <= 0) { movePoint.position += new Vector3(Input.GetAxisRaw("Horizontal"), 0f, 0f); } } } else if (Mathf.Abs(Input.GetAxisRaw("Vertical")) == 1) { if (canMoveZ) { if (stairsZ.Length <= 0) { movePoint.position += new Vector3(0f, 0f, Input.GetAxisRaw("Vertical")); } } } } } else { playerMovement.enabled = true; outliner.DeleteOutline(); } }