Unreal Engine C++ Tutorial Enhanced Input System

Поділитися
Вставка
  • Опубліковано 30 лис 2024

КОМЕНТАРІ • 10

  • @GT_SPEED_BRAZIL
    @GT_SPEED_BRAZIL 10 місяців тому +1

    Very helpful, thank you very much!

  • @yevgeni10
    @yevgeni10 7 місяців тому +1

    Btw it zooms beyond the Character.

    • @sudokid
      @sudokid  7 місяців тому

      It's not supposed to, this is just zooming in and out. If you want to clamp it to a min and max you will need to add a min/max value and then use `FMath::Clamp(NewZoomValue, MinZoomValue, MaxZoomValue);`

    • @yevgeni10
      @yevgeni10 7 місяців тому

      @@sudokid where do i add the Clamp
      if i have ?
      const float ZoomAxisValue = Value.Get();

      if (MinZoom >= ZoomAxisValue || MaxZoom >= ZoomAxisValue)
      {
      CameraBoom->TargetArmLength += ZoomAxisValue * ZoomStep;
      }

    • @sudokid
      @sudokid  7 місяців тому

      ZoomAxisValue will never be greater then 1 or less then -1. You would want something like this.
      ```
      const float Direction = Value.Get();
      const NewTargetArmLength = CameraBoom->TargetArmLength + (ZoomAxisValue * ZoomStep);
      FMath::Clamp(NewTargetArmLength, MinZoom, MaxZoom);
      ```
      `FMath::Clamp()` Is just your `if` statement but less error prone and easier to read because it's more direct.

    • @yevgeni10
      @yevgeni10 7 місяців тому

      @@sudokid What is NewTargetArmLength ??

    • @sudokid
      @sudokid  7 місяців тому

      NewTargetArmLength is just a variable to hold the new value. Your code should look like this.
      ```
      const float Direction = Value.Get();
      const NewTargetArmLength = CameraBoom->TargetArmLength + (ZoomAxisValue * ZoomStep);
      CameraBoom->TargetArmLength = FMath::Clamp(NewTargetArmLength, MinZoom, MaxZoom);
      ```

  • @peacepeace9462
    @peacepeace9462 6 місяців тому

    Could I ask how you get CameraBoom->TargetArmLength component in c++?

    • @sudokid
      @sudokid  6 місяців тому

      `CameraBoom->TargetArmLength`

    • @peacepeace9462
      @peacepeace9462 6 місяців тому +1

      @@sudokid thank you I have figured out