当前位置: 首页 > news >正文

GAS_Aura-Movement Input

1 在AuraPlayerController中

增加virtual SetupInputComponent();//需要增加EnhancedInputComponent.h

{

  UEnhancedInputComponent* InputComponent = Castchecked<UEnhancedInputComponent>(InputComponent);

}

2 在AuraPlayerController.h中

增加TObjectPtr<UInputAction> MoveAction;

 

void Move(cont FInputActionValue& InputActionValue);

3 在AuraPlayerController.cpp中

补充SetupInputComponent()

{

  EnhancedInputComponent->BindAction(MoveAction,ETriggerEvent::Triggered,this,&AAuraPlayerController::Move);

}

Move()

{

  const FVector2D InputAxisVector = InputActionView.Get<FVectot2D>();

  const FRotator Rotation = GetControlRotation();

  const FRotator YawRotation(0.f,Rotation.Yaw,0.f);

 

  const FVector ForwardDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);

  const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);

  if(APawn* ControllerPawn = GetPawn<APawn>())

{

  ControlledPawn->AddMovementInput(ForwardDirection,InputAxisVector,Y);

  ControlledPawn->AddMovementInput(RightDirection ,InputAxisVector,X);

}

}

 

4 创建BP_AuraPlayerController,并将增强输入的两个资产使用上;

http://www.aitangshan.cn/news/283.html

相关文章:

  • 字符串常用方法
  • Linux常用工具
  • 8/11
  • 项目调试
  • C++小白修仙记_LeetCode刷题_算数运算
  • CF1774G Segment Covering
  • 高亮部分文字
  • 使用Python将中文语音翻译成英语音频 - 详解
  • wqs 二分学习笔记
  • 用位运算快速分解整数:从 LeetCode 2438 题谈起
  • 2025-08-11 闲话
  • 2025 暑假集训 Day7
  • SQL优化必备脚本:Oracle获取绑定变量的字面SQL文本
  • Nature Genetics | 解码免疫细胞动态遗传调控机制及其与疾病的关联
  • 8月11日
  • 【Vulnhub】symfonos: 4 2 总结
  • [PaperReading] Helix: A Vision-Language-Action Model for Generalist Humanoid Control
  • OI集训 Day26
  • RESTful 风格(详细介绍 + 案例实现)
  • 如何用 AI 智能体开启副业之路?零基础入门指南
  • 休息一天
  • 2025.08.11 杭电8
  • 提升LangChain开发效率:10个被忽视的高效组件,让AI应用性能翻倍
  • 更不是SaaS终结者
  • MD5加密算法详解:原理、实现与应用
  • Kafka生产者事务机制原理 - 指南
  • 为什么数据库连接很消耗资源?
  • 题解:[JOISC 2022] 京都观光
  • 2025.8.11
  • 2025-08-10 模拟赛总结