Pawn这个单词不会翻译,找不到可以形象描述这个单词的汉语,大概的意思就是可以通过很多的Components合成一个含有多种属性状态的物体。
这里主要是如果获取键盘和鼠标的输入,
在Edit -- Project Setting -- Engine -- Input里面控制,有两种属性,一种是Action Mappings,另外一种是Axis Mapping.
这两种是有区别的,Action主要针对不是连续的,比如跳,射击等,Axis是连续的,比如移动,旋转等。
贴上代码
MyPawn.h
// Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Pawn.h"
#include "MyPawn.generated.h"
UCLASS()
class UNREALLEARN_API AMyPawn : public APawn
{
GENERATED_BODY()
public:
// Sets default values for this pawn's properties
AMyPawn();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
public:
// Called every frame
virtual void Tick(float DeltaTime) override;
// Called to bind functionality to input
virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override;
UPROPERTY(Edit

本文介绍了在Unreal Engine中如何处理玩家输入以及Pawn的概念。Pawn作为游戏对象,可以组合多种组件以实现复杂的行为。通过编辑Project Settings中的Engine > Input设置,可以配置Action Mappings(用于非连续动作如跳跃、射击)和Axis Mapping(用于连续动作如移动、旋转)。文章提供了相关代码示例。
——玩家输入和Pawn(Player Input and Pawns)&spm=1001.2101.3001.5002&articleId=78603219&d=1&t=3&u=b3ebe958151043898785c863b54384cc)
1122

被折叠的 条评论
为什么被折叠?



