void FixedUpdate() { RaycastHit hit = new RaycastHit(); int TARGETABLE_LAYER = 9; float radius = .25f; float maxDist = 30f; int layerMask = 1 << TARGETABLE_LAYER; Vector3 startPos = Player.instance.headCollider.transform.position; Vector3 dir = Player.instance.headCollider.transform.forward; Physics.SphereCast(startPos, radius, dir, out hit, maxDist, layerMask); Debug.DrawRay(startPos, dir); if (hit.collider && hit.collider.gameObject != targetedObject) { targetedObject = hit.collider.gameObject; targetingReticle.GetComponent <FaceThePlayer>().focusedObj = targetedObject; foreach (Hand hand in Player.instance.hands) { try { ISpell spell = hand.hoveringInteractable.gameObject.GetComponent <ISpell>(); spell.SetTarget(targetedObject); } catch (System.Exception) { Debug.Log("No current spell"); } } audioSource.clip = targetFoundClip; audioSource.Play(); } }