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

服务网站 建设原则此网站三天换一次域名

服务网站 建设原则,此网站三天换一次域名,模板建网站,韩国网站域名分类一、关于增强输入系统的介绍 增强输入系统官方文档介绍 二、增强输入系统的具体使用 注:在使用方面,不会介绍如何创建项目等基础操作,如果还没有UE的使用基础,可以参考一下我之前UE4的文章,操作差别不会很大。 如上…

一、关于增强输入系统的介绍

增强输入系统官方文档介绍

二、增强输入系统的具体使用

注:在使用方面,不会介绍如何创建项目等基础操作,如果还没有UE的使用基础,可以参考一下我之前UE4的文章,操作差别不会很大。

如上图所示,在自己创建好的项目工程中,找到.Build.cs文件,在添加的模块引用中,添加EnhancedInput模块,添加这个模块之后,才能在写完增强输入系统的代码后正确运行。

代码:

//输入映射
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input", meta = (AllowPrivateAccess = "true"))class UInputMappingContext* DefaultMappingContext;
//移动
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input", meta = (AllowPrivateAccess = "true"))class UInputAction* MoveAction;
//上下左右看
UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = "Input", meta = (AllowPrivateAccess = "true"))class UInputAction* LookAction;

在我们创建完成的角色类中添加必要的组件,比如摄像机臂组件和摄像机组件。UInputMappingContext是用来引用操作上下文,而UInputAction对应某个具体的操作,比如我们的WASD前后左右移动,鼠标轴挥动去上下左右看,当我们的Action创建完成之后,去放到操作上下文中去映射,这个时候我们的输入便被绑定到角色中。

代码:

UEnhancedInputComponent* EnhancedInputComponent = CastChecked<UEnhancedInputComponent>(PlayerInputComponent);
if (EnhancedInputComponent && MoveAction && LookAction)
{EnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered,this,&ASCharacter::Move);EnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &ASCharacter::Look);}

在角色输入绑定函数中,用增强输入组件去绑定Action,之后输入操作按键便会执行对应的操作。

对于ETriggerEvent,在引擎源代码中有相应的介绍,有按键按下,一直按住,松开时的处理,会比UE4的输入更加详细。

在Move和Look的函数中,处理角色移动和上下左右看。

Move代码:

    FVector2D MovementVector = Value.Get<FVector2D>();if (Controller){const FRotator ControlRotation = Controller->GetControlRotation();const FRotator YawRotation = FRotator(0.0f,ControlRotation.Yaw,0.0f);const FVector ForawrdDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X);const FVector RightDirection = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y);AddMovementInput(ForawrdDirection,MovementVector.Y);AddMovementInput(RightDirection, MovementVector.X);}

Look代码:

    FVector2D LookVector = Value.Get<FVector2D>();if (Controller){AddControllerYawInput(LookVector.X);AddControllerPitchInput(LookVector.Y);}

以上处理完成之后,需要在游戏运行的时候,添加增强输入系统的映射。

    APlayerController* PlayerController = Cast<APlayerController>(Controller);UEnhancedInputLocalPlayerSubsystem* EnhancedInputSystem = ULocalPlayer::GetSubsystem<UEnhancedInputLocalPlayerSubsystem>(PlayerController->GetLocalPlayer());if (EnhancedInputSystem && DefaultMappingContext){EnhancedInputSystem->AddMappingContext(DefaultMappingContext,0);}

这个时候,回到引擎中,去创建一个输入映射和move、look的Action。

在移动和上下左右看的Action中,添加需要操作的按键。

MappingContext中绑定,注意方向输入:

注意在角色蓝图中去选择创建的输入和映射。

http://www.zhongyajixie.com/news/38197.html

相关文章:

  • 河北建设机械协会网站seo品牌推广方法
  • 深圳专业网站建设制作全球疫情最新数据统计
  • 怎么做集合网站seo是什么职位
  • 快速一体化网站建设搜索引擎 磁力吧
  • 免费注册网seo网站关键词优化哪家好
  • 服务器托管运营商英文外链seo兼职在哪里找
  • 人和兽做的网站视频全网营销推广方案外包
  • 免费做图片链接网站广州头条今日头条新闻
  • 北京旅游网站建设seo关键词排行优化教程
  • 用手机做网站的软件常用的营销策略
  • 大连网站建设公司哪家好无忧seo
  • 在线教学的网站开发方案清博大数据舆情监测平台
  • wordpress 文件大小限制网站排名优化多少钱
  • 工具网站有哪些婚恋网站排名前十名
  • 在北京网站建设的岗位站长统计app软件下载
  • 徐州网站建设的特点2345浏览器导航页
  • 大连网站建设找哪家好促销方法100种
  • 手机搭建免费网站关于普通话的手抄报
  • 网站首次备案搜索引擎优化的主要策略
  • 学做美食网站郑州网站seo服务
  • 做钢管网站品牌策划设计
  • 网站建设沟通话术永久免费域名申请
  • shopex网站经常出错市场营销在线课程
  • 网站搬家教程互联网电商平台
  • 太原市建设局网站首页信息流优化师
  • 网站维护中页面模板凤凰军事新闻最新消息
  • 杭州公司网站设计新手学seo
  • 衡水教育行业网站建设搜索大全引擎入口网站
  • 交友网站建设策划方案(2)百度客服电话是多少
  • 无锡 做公司网站长沙网站优化方法