中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁(yè) > news >正文

莆田有哪幾家做網(wǎng)站設(shè)計(jì)的全球網(wǎng)站排名前100

莆田有哪幾家做網(wǎng)站設(shè)計(jì)的,全球網(wǎng)站排名前100,hao123我的上網(wǎng)主頁(yè)hao123,杭州市網(wǎng)站推廣UE4直接在項(xiàng)目設(shè)置里設(shè)置的軸映射和操作映射在UE5中被標(biāo)記為廢棄,改為使用增強(qiáng)輸入系統(tǒng)。 這兩天學(xué)習(xí)了下藍(lán)圖和c中增強(qiáng)輸入系統(tǒng)的使用,在這里分享一下。 學(xué)習(xí)使用的模板是第三人稱模板(藍(lán)圖/c),代碼藍(lán)圖都參考的模板。 增強(qiáng)輸入系統(tǒng) UE5…

UE4直接在項(xiàng)目設(shè)置里設(shè)置的軸映射和操作映射在UE5中被標(biāo)記為廢棄,改為使用增強(qiáng)輸入系統(tǒng)。

這兩天學(xué)習(xí)了下藍(lán)圖和c++中增強(qiáng)輸入系統(tǒng)的使用,在這里分享一下。

學(xué)習(xí)使用的模板是第三人稱模板(藍(lán)圖/c++),代碼藍(lán)圖都參考的模板。

增強(qiáng)輸入系統(tǒng)

UE5中加入的用來(lái)處理輸入的系統(tǒng)。

分為兩部分,分別是輸入操作輸入映射情境。在虛幻編輯器中通過(guò)右鍵添加->輸入->輸入操作/輸入映射情境來(lái)創(chuàng)建。

請(qǐng)?zhí)砑訄D片描述

輸入操作 InputAction

顧名思義,用來(lái)綁定特定的操作,例如鍵盤、鼠標(biāo)、手柄的某個(gè)按鍵。

ThirdPerson/Blueprints/Input/Actions目錄下,可以看到模板自帶的幾個(gè)輸入操作

請(qǐng)?zhí)砑訄D片描述

我們雙擊點(diǎn)開(kāi)IA_Move查看細(xì)節(jié)

請(qǐng)?zhí)砑訄D片描述

看到值類型為Axis2D,這個(gè)值類型是用來(lái)設(shè)置輸入的值的,因?yàn)橐苿?dòng)是一個(gè)X,Y軸上的二維操作,所以我們選擇Axis2D,如果是跳躍的話,則使用數(shù)字(布爾)。

模板通過(guò)創(chuàng)建輸入操作成功綁定了幾種輸入操作,分別是觀察、跳躍和移動(dòng),接下來(lái)我們將在輸入映射情境中為輸入操作綁定按鍵和設(shè)置。

輸入映射情境 InputMappingContext

用來(lái)給輸入操作綁定具體的按鍵和一些處理的資產(chǎn)。

ThirdPerson/Blueprints/Input中,已經(jīng)有一個(gè)IMC_Default的輸入映射情境,可以打開(kāi)看一下怎么使用。

請(qǐng)?zhí)砑訄D片描述

通過(guò)映射旁邊的加號(hào)可以添加操作映射,新建后首先選擇我們的一個(gè)輸入操作,例如第一個(gè)的IA_Jump,之后點(diǎn)擊旁邊的加號(hào)為IA_Jump操作進(jìn)行控制綁定??梢钥吹竭@里為IA_Jump跳躍綁定了鍵盤空格、手柄正面按鈕下和觸摸1。IA_Move移動(dòng)綁定了鍵盤WASD,上下左右鍵和手柄左搖桿2D軸。

點(diǎn)開(kāi)每個(gè)按鍵的下三角,可以看到可以配置觸發(fā)器和修改器,用于在按下后進(jìn)行一個(gè)設(shè)置。由于跳躍比較簡(jiǎn)單,所以沒(méi)有觸發(fā)器和修改器。我們看看WS按鍵的相關(guān)設(shè)置

請(qǐng)?zhí)砑訄D片描述

W鍵在修改器中添加了一個(gè)拌合輸入軸值,這個(gè)是用例交換X、Y軸的,如果不設(shè)置這個(gè),默認(rèn)是X軸的移動(dòng),也就是向右走。

S鍵在W鍵的基礎(chǔ)上設(shè)置了一個(gè)否定,也就是去負(fù)值,表示向后走。

其他按鍵可自行查看。

使用

現(xiàn)在我們有了輸入操作和輸入映射情境后就已經(jīng)做好了一套輸入映射,例如WASD移動(dòng)、空格跳躍等,接下來(lái)我們要在藍(lán)圖和C++中使用我們做好的綁定。

藍(lán)圖中

我們查看/content/ThirdPerson/Blueprints/BP_ThirdPersonCharacter的事件圖表,在最上面首先綁定了輸入映射情境

請(qǐng)?zhí)砑訄D片描述

之后對(duì)每個(gè)輸入映射都進(jìn)行了相應(yīng)的處理,我們先看移動(dòng)輸入

請(qǐng)?zhí)砑訄D片描述

這里IA_MoveActionValue是一個(gè)二維向量,因?yàn)樵?code>IA_Move里設(shè)置的值類型為Axis2D,X軸表示左右移動(dòng),Y軸表示前后移動(dòng),這里具體的值取決于我們是鍵盤還是手柄,鍵盤是話應(yīng)該就是1,手柄則是根據(jù)左搖桿劃的程度來(lái)獲得一個(gè)0~1的值。選擇Triggered來(lái)連線表示持續(xù)觸發(fā)。如果是跳躍操作,應(yīng)該選擇Started,可自行查看。

如此我們就在藍(lán)圖中完成了使用增強(qiáng)輸入系統(tǒng)。

c++

c++中我們的角色基類為項(xiàng)目名+Character.h,以下為源代碼

// Copyright Epic Games, Inc. All Rights Reserved.#pragma once#include "CoreMinimal.h"
#include "GameFramework/Character.h"
#include "Logging/LogMacros.h"
#include "ThirdPersonCppDemoCharacter.generated.h"class USpringArmComponent;
class UCameraComponent;
class UInputMappingContext;
class UInputAction;
struct FInputActionValue;DECLARE_LOG_CATEGORY_EXTERN(LogTemplateCharacter, Log, All);UCLASS(config=Game)
class AThirdPersonCppDemoCharacter : public ACharacter
{GENERATED_BODY()/** Camera boom positioning the camera behind the character */UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))USpringArmComponent* CameraBoom;/** Follow camera */UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true"))UCameraComponent* FollowCamera;/** MappingContext */UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))UInputMappingContext* DefaultMappingContext;/** Jump Input Action */UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))UInputAction* JumpAction;/** Move Input Action */UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))UInputAction* MoveAction;/** Look Input Action */UPROPERTY(EditAnywhere, BlueprintReadOnly, Category = Input, meta = (AllowPrivateAccess = "true"))UInputAction* LookAction;public:AThirdPersonCppDemoCharacter();protected:/** Called for movement input */void Move(const FInputActionValue& Value);/** Called for looking input */void Look(const FInputActionValue& Value);protected:// APawn interfacevirtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;// To add mapping contextvirtual void BeginPlay();public:/** Returns CameraBoom subobject **/FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; }/** Returns FollowCamera subobject **/FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; }};

可以看到,這里創(chuàng)建了幾個(gè)UInputAction類對(duì)象,對(duì)應(yīng)的就是輸入操作UInputMappingContext* DefaultMappingContext;對(duì)應(yīng)的是輸入映射情境,我們?cè)O(shè)置為藍(lán)圖可編輯,之后派生出藍(lán)圖類后在類默認(rèn)值那里可以設(shè)置。在BeginPlay函數(shù)中,把DefaultMappingContext給了增強(qiáng)輸入系統(tǒng)。

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

virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;APawn的接口,我們需要實(shí)現(xiàn)它,它就是用來(lái)設(shè)置按鍵按下后的反應(yīng)。此為模板為跳躍、移動(dòng)和觀察實(shí)現(xiàn)的該函數(shù)。

void AThirdPersonCppDemoCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputComponent)
{// Set up action bindingsif (UEnhancedInputComponent* EnhancedInputComponent = Cast<UEnhancedInputComponent>(PlayerInputComponent)) {// JumpingEnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Started, this, &ACharacter::Jump);EnhancedInputComponent->BindAction(JumpAction, ETriggerEvent::Completed, this, &ACharacter::StopJumping);// MovingEnhancedInputComponent->BindAction(MoveAction, ETriggerEvent::Triggered, this, &AThirdPersonCppDemoCharacter::Move);// LookingEnhancedInputComponent->BindAction(LookAction, ETriggerEvent::Triggered, this, &AThirdPersonCppDemoCharacter::Look);}else{UE_LOG(LogTemplateCharacter, Error, TEXT("'%s' Failed to find an Enhanced Input component! This template is built to use the Enhanced Input system. If you intend to use the legacy system, then you will need to update this C++ file."), *GetNameSafe(this));}
}

上面代碼段中的Move、Look函數(shù)為模板實(shí)現(xiàn)的函數(shù)

http://www.risenshineclean.com/news/9637.html

相關(guān)文章:

  • 建筑工程有限責(zé)任公司搜索引擎優(yōu)化教程
  • 公司網(wǎng)站的建站要點(diǎn)seo還有前景嗎
  • 西安網(wǎng)站設(shè)計(jì)品牌詞優(yōu)化
  • 華碩路由器做網(wǎng)站什么軟件可以發(fā)帖子做推廣
  • 做電商有哪些網(wǎng)站推廣平臺(tái)收費(fèi)標(biāo)準(zhǔn)
  • 上海網(wǎng)站改版服務(wù)百度葷seo公司
  • 小米手機(jī)做網(wǎng)站服務(wù)器嗎網(wǎng)站排名優(yōu)化公司
  • 哈爾濱快速建站案例百度識(shí)圖網(wǎng)頁(yè)版入口
  • 彩票網(wǎng)站怎么做的營(yíng)銷模式
  • 凡科做網(wǎng)站不要錢seo搜索引擎入門教程
  • 做報(bào)名網(wǎng)站中國(guó)國(guó)家培訓(xùn)網(wǎng)是真的嗎
  • spd2007怎么創(chuàng)建網(wǎng)站品牌推廣的意義
  • 網(wǎng)站開(kāi)發(fā)代理報(bào)價(jià)表成都私人網(wǎng)站制作
  • 北京做網(wǎng)站在線html5制作網(wǎng)站
  • 泰安人力資源招聘長(zhǎng)沙靠譜關(guān)鍵詞優(yōu)化服務(wù)
  • 獨(dú)立設(shè)計(jì)購(gòu)物網(wǎng)站網(wǎng)絡(luò)推廣方案范例
  • 網(wǎng)站seo優(yōu)化關(guān)鍵詞國(guó)內(nèi)外搜索引擎大全
  • 學(xué)校網(wǎng)站設(shè)計(jì)的作用營(yíng)銷平臺(tái)建設(shè)
  • wordpress限制站點(diǎn)使用時(shí)間河南品牌網(wǎng)站建設(shè)
  • 最基本的網(wǎng)絡(luò)營(yíng)銷站點(diǎn)西安優(yōu)化網(wǎng)站公司
  • wordpress做的好的網(wǎng)站如何優(yōu)化網(wǎng)站快速排名
  • 萊山做網(wǎng)站的公司熊貓關(guān)鍵詞工具官網(wǎng)
  • 域名注冊(cè)后怎么建網(wǎng)站全網(wǎng)營(yíng)銷推廣案例
  • 商城網(wǎng)站都有什么功能模塊免費(fèi)網(wǎng)站推廣工具
  • 網(wǎng)站建設(shè)規(guī)劃書(shū)的空間seo軟文代寫(xiě)
  • 做網(wǎng)站學(xué)習(xí)營(yíng)銷策略范文
  • 長(zhǎng)沙企業(yè)網(wǎng)站建設(shè)服務(wù)怎么做網(wǎng)址
  • 淮北市住房和城鄉(xiāng)建設(shè)局網(wǎng)站出售外鏈
  • 門戶網(wǎng)站類型北京疫情消息1小時(shí)前
  • 手機(jī)網(wǎng)站制作費(fèi)用多少seo廠商