private void FixedUpdate() { if (inGame) { if (isGrabbing) { GameManager.Instance.StartGame(); Koma_Rotate.StartRotate(); inGame = false; } } }
// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { if (hit.collider.tag == "Obi") { isGrabbing = true; cube = hit.transform; } } } if (!inGame) { transform.Translate(-0.5f, 0, 0); Koma_Rotate.StartRotate(); } /* * if (isGrabbing) * { * Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); * float rayDistance; * plane.Raycast(ray, out rayDistance); * * cube.position = ray.GetPoint(rayDistance); * * if (Input.GetMouseButtonUp(0)) * { * isGrabbing = false; * } * } */ }