Crosshair3D.LateUpdate C# (CSharp) Метод

LateUpdate() приватный Метод

private LateUpdate ( ) : void
Результат void
    void LateUpdate()
    {
        Ray ray;
        RaycastHit hit;
        bool cursorSet = false;
        Ray camRay = CameraRay();
        Vector3 cameraPosition = camRay.origin;
        Vector3 cameraForward = camRay.direction;

        if (matchDepthOnHitMode)  // disabled this, but might be needed later
        {
          // cursor positions itself in 3D based on raycasts into the scene
          // trace to the spot that the player is looking at
          ray = new Ray(cameraPosition, cameraForward);
          if (Physics.Raycast(ray, out hit))
          {
        // distance = hit.distance;
        transform.position = hit.point + (-cameraForward * offsetFromObjects);

        cursorSet = true;
          }
        }

        if (!cursorSet)
        {
          transform.position = cameraPosition + (cameraForward * fixedDepth);
        }

        // keeps the sprite pointed towards camera
        transform.forward = cameraForward;

        if (AppCentral.APP.UserClicked())
        {
          ray = new Ray(cameraPosition, cameraForward);
          if (Physics.Raycast(ray, out hit))
          {
        SendEventToGameObject(hit.transform.gameObject, "OnClick");
          }

          // show cross hair temporarily if in the showOnClickOnly mode
          UpdateCrosshairOnClick();
        }

        UpdateHoverState();
        UpdateButtonRevealer();
    }