private void HandleAiming() { //AIMING SECTION if (Input.GetMouseButton(1) &&…
- User
private void HandleAiming() { //AIMING SECTION if (Input.GetMouseButton(1) && !m_Animator.GetCurrentAnimatorStateInfo(1).IsName("IdleBandage") && shotgun.activeInHierarchy == true && !isSettingTrap) { m_Animator.SetBool("isAiming", true); isAiming = true; fLook.enabled = false; if (mainCamera != null) { Ray ray = mainCamera.ViewportPointToRay(Vector3.one * 0.5f); //Debug.DrawRay (ray.origin, ray.direction * maxDistance, Color.magenta, 2f); RaycastHit hit;
if (Physics.Raycast(ray.origin, ray.direction, out hit, Mathf.Infinity, layerMask)) { zombieHealth = hit.collider.GetComponentInParent<DemoEnemyControls>(); crawlerControls = hit.collider.GetComponentInParent<CrawlerControls>(); easterEgg = hit.collider.GetComponent<EasterEgg>(); bool gasoline = hit.transform.gameObject.CompareTag("Gas"); if (Physics.Raycast(ray.origin, ray.direction, out hit, Mathf.Infinity, obstacleMask)) //White Reticle If Obstacles { Reticle.SetActive(true); RedReticle.SetActive(false); } else if (zombieHealth != null || crawlerControls != null || easterEgg != null || gasoline) { //Red Reticle If Available Target RedReticle.SetActive(true); Reticle.SetActive(false); } } else { //White Reticle If Nothing Reticle.SetActive(true); RedReticle.SetActive(false); } } } else { m_Animator.SetBool("isAiming", false); isAiming = false; fLook.enabled = true; Reticle.SetActive(false); RedReticle.SetActive(false); } } - Assistant
- User
How would I set the weapon firepoint to face toward the center of the screen and set back its original position when not aiming
- Assistant
- User
i need the actual weapon to be aligned toward the center of the screen
- Assistant
- User
the weapon is rotating to the left instead of center screen
- Assistant
- User
its because i need the -x axis to be aligne to the center, not the forward axis
- Assistant