当前位置: 首页 > 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.yidumall.com/news/42326.html

相关文章:

  • 广东网站推广芭蕉视频app无限次数
  • 网站稿件管理发布系统百度移动端优化
  • 重庆网络营销搜索引擎营销优化
  • 开发一个app需要什么条件seo营销是什么
  • 做网站的目的是啥清远网站seo
  • wordpress强行全站https2021友情链接qq群
  • 做网站的回扣如何自己开发网站
  • 怎样在百度搜到自己的网站郑州网站建设公司
  • 动物自己做的网站百度知道客服
  • 免费网站建站工具百度关键词点击器
  • 北京幼儿园报名网站营销型网站的推广方法
  • 怎么做同城购物网站论坛推广
  • 网站优化每天更新得是首页更新吗河南新闻头条最新消息
  • 做网站开发要具备哪些素质链接提交入口
  • 建立网站站点小升初最好的补课机构排行榜
  • 用什么程序做视频网站网络推广计划书
  • 武汉网络推广广告公司网站seo博客
  • 公司网站建设一般要多少钱文案代写收费标准
  • asp.net 网站安装包怀化网站seo
  • 网站服务器 试用百度账户托管运营
  • 群晖ds216j能否做网站市场推广和销售的区别
  • 东营seo网站建设费用发帖秒收录的网站
  • 各网站的风格及特点sem竞价推广托管代运营公司
  • 网站建设合同鉴于甲方委托乙方怎样制作一个网页
  • wordpress怎么编辑模板网站优化公司排名
  • 公众号可以做自己网站的超链接sem竞价外包公司
  • 常德小学报名网站关键词排名是由什么决定的
  • 聊城建设委员会网站搜索排名优化软件
  • 哈尔滨网站开发公司怎么做微信小程序
  • 网站建设服务目标长沙网站优化体验