• UE4C++5加速跑/二倍镜


    //按键绑定
        PlayerInputComponent->BindAction("Sprint", IE_Pressed, this, &ALeamCppCharacter::SprintBegin);
        PlayerInputComponent->BindAction("Sprint", IE_Released, this, &ALeamCppCharacter::SprintStop);
    //头文件
    #include "GameFramework/CharacterMovementComponent.h"
    //对应函数,h里声明完的实现
    void ALeamCppCharacter::SprintBegin()
    {
        GetCharacterMovement()->MaxWalkSpeed = 2200;
    }
    
    void ALeamCppCharacter::SprintStop()
    {
        GetCharacterMovement()->MaxWalkSpeed = 600;
    }
    //二倍镜
    ALeamCppCharacter::ALeamCppCharacter() { PrimaryActorTick.bCanEverTick
    = true;//Tick是否被启用 } void ALeamCppCharacter::BeginPlay() {//时间轴 FloatCurve = NewObject<UCurveFloat>(); FloatCurve->FloatCurve.AddKey(0, 90); FloatCurve->FloatCurve.AddKey(0.3, 45); FOnTimelineFloatStatic OnTimeCallback; OnTimeCallback.BindUFunction(this, TEXT("DoZoom")); ZoomTimeline.AddInterpFloat(FloatCurve, OnTimeCallback); } void ALeamCppCharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) { PlayerInputComponent->BindAction("Zoom", IE_Pressed, this, &ALeamCppCharacter::ZoomBegin); PlayerInputComponent->BindAction("Zoom", IE_Released, this, &ALeamCppCharacter::ZoomStop); } void ALeamCppCharacter::ZoomBegin() { //FirstPersonCameraComponent->FieldOfView = 45; ZoomTimeline.Play(); } void ALeamCppCharacter::ZoomStop() { //FirstPersonCameraComponent->FieldOfView = 90; ZoomTimeline.Reverse(); } void ALeamCppCharacter::DoZoom(float FieldOfView) { FirstPersonCameraComponent->SetFieldOfView(FieldOfView); } void ALeamCppCharacter::Tick(float DeltaSeconds) { Super::Tick(DeltaSeconds); ZoomTimeline.TickTimeline(DeltaSeconds); }
  • 相关阅读:
    webpack source map
    webpack 多页面应用打包
    webpack 资源内联
    webpack 移动端 CSSpx 自动转换成 rem
    webpack postcss插件
    css实现banner背景图上文字效果+
    css实现标题下划线效果
    Day 88 Django_DRF 序列化
    Day 87 VUE——xmall_front 案例
    Day 86 VUE——Vuex
  • 原文地址:https://www.cnblogs.com/tilyougogannbare666/p/14034846.html
Copyright © 2020-2023  润新知