Exemplo n.º 1
0
    private void InputAim()
    {
        if (allowAiming)
        {
            mouseSensitivity           = PlayerPrefs.GetFloat("mouseSensitivity", 10.0f);
            kartCamera.mouseHorizontal = -Input.GetAxis("Mouse Y") * mouseSensitivity;
            kartCamera.mouseVertical   = Input.GetAxis("Mouse X") * mouseSensitivity;

            Ray cameraRay = playerCamera.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

            RaycastHit hitInfo;
            if (Physics.Raycast(cameraRay, out hitInfo, 100000f, maskIgnoreKartBullet))
            {
                kartGun.AimAtPoint(hitInfo.point);
            }
            else
            {
                kartGun.AimAtPoint(playerCamera.transform.forward * 100000f + playerCamera.transform.position);
            }
        }
    }
Exemplo n.º 2
0
 private void Movement()
 {
     navMeshAgent.Resume();
     kartGun.AimAtPoint(transform.position + transform.forward * 1000);
 }