Hi,

we are using new input system. I saw in your roadmap you want to support it in the future.

Can I workaround the missing integration? I only found out that I can map some actions to predefined mouse keys.

Looking for something like call "cameraController.moveRight();" if player pressed "D".

Looking for a litte overview of the controller API 🙂

Thanks

    Dennis Hi Denis! Keyboard inputs to move the camera are not implemented as this is a mouse/touch camera plugin, and usually keyboard inputs will be implemented differently for each project.

    If you need to change the camera position you can add a method like so in CameraPerspective for example:

    public void MoveCameraToInstant(Vector3 targetPosition)
    {
    finalOffset = targetPosition;
    finalPosition = CalculateNewPosition(finalOffset, finalRotation, finalDistance);
    ApplyToCamera();
    }

    If you want to animate with a tween you can try this:

    public void MoveCameraTo(Vector3 targetPosition)
    {
    StopFollow();
    Vector3 currentOffset = finalOffset;
    disableMoves = true;
    float lerp = 0;
    Tween t = DOTween.To(() => lerp, x => lerp = x, 1, focusTweenDuration).SetEase(focusEase);
    t.OnUpdate(() =>
    {
    finalOffset = Vector3.Lerp(currentOffset, targetPosition, lerp);
    finalPosition = CalculateNewPosition(finalOffset, finalRotation, finalDistance);
    ApplyToCamera();
    })
    .OnComplete(() =>
    {
    disableMoves = false;
    });
    }

    Basically you just need to increment or set the variable "finalOffset" which is the center point of the camera on the ground, and then update the camera position with CalculateNewPosition().

    I hope that helps!

      Thanks Anthony,

      we will buy and try 🙂

      I think i need the first instant solution.

      I need the current Position of the ground to do something link this:

      var currentPosition = ??
      var newPosition = currentPosition + transform.right * movementSpeed * Time.deltaTime;
      MoveCameraToInstant(newPosition);

      How can I get the current pos? 🙂

      Thanks

        Dennis you can use

        var currentPosition = camCompnent.FinalOffset;
        var newPosition = currentPosition + transform.right * movementSpeed * Time.deltaTime;
        camCompnent.MoveCameraToInstant(newPosition);

          Hi Anthony,

          there is no method MoveCameraToInstant in the cam component

          See this small example:
          var camCompnent = Camera.main.gameObject.GetComponent<CameraPerspective>();
          var currentPosition = camCompnent.FinalOffset;
          var newPosition = currentPosition + transform.right * movementSpeed * Time.deltaTime;
          camCompnent.MoveCameraToInstant(newPosition);

          Did you mean that I have to write the method myself? I want to move the camera over your functions so that the boundaries are taken into account etc..

          My goal is that while I press WASD the camera moves in the appropriate direction and as soon as I let go the camera stops immediately.

          Thanks 🙂

            2 months later
            Write a Reply...