void Start() { cam = Camera.main; limbPrototype = Instantiate(limbPrefab, null); limbPrototype.SetVisible(false); limbPrototype.SetColliderEnabled(false); closeupUI = FindObjectOfType <CloseupCameraUI>(); closeupUI.SetActive(false); closeupCamera = FindObjectOfType <CloseupCamera>(); }
void TargetLimb() { Vector3 limbPosition = cam.ScreenToWorldPoint(transform.position); limbPosition.z = 0; Vector3 sproutPosition = targetLimb.GetClosestBoundsPoints(limbPosition); Vector3 limbDirection = (limbPosition - targetLimb.GetLimbCentre()).normalized; limbPrototype.transform.rotation = Quaternion.Lerp(limbPrototype.transform.rotation, Quaternion.LookRotation(Vector3.forward, limbDirection), 10 * Time.deltaTime); limbPrototype.SetLimbLine(true, sproutPosition, limbPrototype.transform.up * 0.1f); limbPrototype.SetVisible(true); closeupCamera.SetPosition(limbPrototype.transform.position + (Vector3.forward * -0.5f)); }