Ninja Input - 01 - Installation and Overview

Ninja Bear Studio
8 Jan 202306:23

Summary

TLDR本视频由Ninja Bear Studio的Uriel主讲,介绍了适用于Unreal Engine的Ninja输入插件。该插件旨在利用Unreal Engine 5.0及以上版本的增强输入系统来处理玩家输入。视频中,Uriel通过创建一个基于第三人称模板的新项目,展示了如何激活并使用Ninja输入插件来替代默认的输入处理代码。他详细解释了如何设置输入管理器组件、配置输入映射上下文和输入处理程序,以实现角色移动、摄像机控制和跳跃功能。最后,他清理了不再需要的原始输入动作,为进一步扩展功能做准备。

Takeaways

  • 🎮 Ninja输入插件是为Unreal Engine Marketplace设计的,用于帮助处理使用增强输入功能的玩家输入。
  • 🔧 插件通过更新第三人称模板来演示其基本功能,无需添加起始内容。
  • 📈 从Unreal Engine 5.1开始,默认使用增强输入插件,但视频使用5.0版本展示如何启用。
  • 🛠️ 通过插件标签激活增强输入和Ninjia输入插件,并重启引擎。
  • ⚙️ 在项目设置中将增强输入设置为默认输入管理器,并在角色蓝图中移除预配置的输入处理代码。
  • 🧩 向角色添加输入管理器组件,并设置输入上下文映射和移动处理器。
  • 🔄 组件属性面板包含要跟踪的事件列表、注册的输入映射上下文和可用的处理程序。
  • 👨‍💻 输入处理器是负责处理一个或多个映射输入动作的小段代码,可以跨角色或项目重用。
  • 🎛️ 移动处理器具有特定的默认属性,例如动作和事件,这些属性决定了处理器的操作方式。
  • 🔄 通过添加额外的处理程序,如查看处理器和角色跳跃处理器,恢复了所有原始输入功能。
  • 🔧 在项目设置中删除不再需要的原始动作,为进一步扩展做准备。

Q & A

  • Ninja输入插件是为哪个游戏引擎设计的?

    -Ninja输入插件是为Unreal Engine设计的。

  • 在Unreal Engine中,如何启用增强输入插件?

    -在Unreal Engine中,可以通过插件标签页找到增强输入插件,然后激活它。

  • 为什么在视频中选择使用Unreal Engine 5.0而不是5.1?

    -视频中使用Unreal Engine 5.0是为了展示如何在非默认情况下启用增强输入插件。

  • 在Unreal Engine中,如何将增强输入设置为默认输入管理器?

    -在项目设置窗口的输入类别中更改默认输入类即可。

  • Ninja输入插件中的输入管理器组件需要哪些属性才能工作?

    -输入管理器组件需要设置输入上下文映射和移动处理器。

  • 在Ninja输入插件中,输入映射上下文的作用是什么?

    -输入映射上下文用于注册输入动作,定义了输入动作与特定输入事件的关联。

  • 如何通过Ninja输入插件处理角色移动、视角旋转和跳跃?

    -通过添加相应的输入处理器,如移动处理器、视角处理器和角色跳跃处理器,来处理这些输入。

  • 在Ninja输入插件中,输入处理器的作用是什么?

    -输入处理器是专门负责处理一个或多个映射输入动作的代码片段。

  • 为什么在视频中移除了角色蓝图中预配置的输入处理代码?

    -为了用Ninja输入插件重新创建输入处理功能,所以移除了原有的输入处理代码。

  • 在视频中提到的'事件'、'输入映射上下文'和'输入处理器'分别是什么?

    -事件是组件跟踪的输入动作,输入映射上下文是注册的输入动作集合,输入处理器是处理这些输入动作的代码。

  • 在Ninja输入插件中,如何删除不再需要的原始输入动作?

    -在项目设置的输入部分,可以删除不再需要的原始输入动作。

Outlines

00:00

🎮 Unreal Engine中的Ninja输入插件介绍

本段介绍了Ninja输入插件,这是一个用于Unreal Engine的插件,专门用于处理玩家输入。视频中通过更新第三人称模板来展示其基本功能。首先,创建一个基于第三人称模板的新项目,并命名为'Ninja input Labs'。在Unreal Engine 5.0版本中,虽然增强输入插件是默认的输入管理器,但视频中演示了如何激活它。接下来,通过项目设置将增强输入设置为默认输入管理器,并在角色蓝图中移除预配置的输入处理代码,准备使用Ninja输入插件重新创建这些功能。最后,向角色添加输入管理器组件,并设置输入上下文映射和移动处理器。通过这些步骤,角色能够再次响应输入,但还需要处理相机和跳跃按钮。

05:00

🔧 Ninja输入插件的事件和处理器配置

本段深入探讨了Ninja输入插件的事件跟踪、输入映射上下文和可用处理器。首先,组件需要跟踪一系列事件,这些事件由增强输入插件定义。输入映射上下文至少需要一个,以确定注册的优先级。数据资产中预配置了移动、查看和跳跃等输入动作。输入处理器是专门处理一个或多个映射输入动作的代码片段,可以跨多个角色或项目重用。例如,移动处理器具有特定的属性,如触发和持续事件,确保在任何移动输入按钮按下时每帧都执行。此外,还添加了查看处理器和角色跳跃处理器,它们也预配置了适当的输入动作和事件。通过这些配置,所有原始输入功能得以恢复,包括角色移动、相机旋转和跳跃。最后,视频中提到将在下一个视频中展示如何实现蹲伏和瞄准功能。

Mindmap

Keywords

💡Ninja输入插件

Ninja输入插件是Unreal Engine市场上的一个插件,它旨在帮助处理使用Unreal Engine新增强输入系统的玩家输入。这个插件是视频的主要焦点,因为它被用来替换默认的输入处理方式,以实现更灵活和强大的输入管理。

💡Unreal Engine

Unreal Engine是一个游戏开发引擎,广泛用于创建高质量的游戏和交互式体验。在视频中,Unreal Engine是Ninja输入插件运行的平台,也是教程中创建项目的基础。

💡增强输入

增强输入是指Unreal Engine中一个更新的输入系统,它提供了比旧版本更高级的输入处理功能。在视频中,使用增强输入系统是实现Ninja输入插件功能的基础。

💡蓝图

蓝图是Unreal Engine中的一种可视化脚本系统,允许开发者通过拖放节点来创建游戏逻辑,无需编写代码。视频中提到使用蓝图创建基于第三人称模板的新项目。

💡第三人称模板

第三人称模板是Unreal Engine中预设的项目模板之一,提供了一个基础的第三人称视角的游戏框架。在视频中,这个模板被用来作为开始项目和演示Ninja输入插件的起点。

💡输入管理器组件

输入管理器组件是Ninja输入插件的一部分,它负责处理玩家的输入并将这些输入转发给相关的处理程序。在视频中,将此组件添加到角色是实现自定义输入处理的关键步骤。

💡输入上下文映射

输入上下文映射定义了一组输入操作和它们对应的处理方式。在视频中,配置输入上下文映射是设置Ninja输入插件以识别和响应特定输入的关键步骤。

💡输入处理程序

输入处理程序是Ninja输入插件中的一个组件,它负责处理特定的输入动作。视频中提到了移动处理程序、查看处理程序和角色跳跃处理程序,这些都是用来响应玩家的不同输入动作。

💡数据资产

数据资产在Unreal Engine中是一种可以配置和引用的资源,用于存储游戏逻辑、输入映射等信息。在视频中,提到了配置数据资产以包含移动、查看和跳跃等预配置的输入动作。

💡项目设置

项目设置是Unreal Engine中用于配置项目级别选项的界面,包括输入管理器的设置。在视频中,通过项目设置将增强输入设置为默认输入管理器,这是启用Ninja输入插件的步骤之一。

💡输入动作

输入动作是玩家可以执行的操作,如移动、跳跃或查看,它们在Unreal Engine中被定义并映射到特定的输入。在视频中,输入动作是Ninja输入插件处理程序识别和响应的关键元素。

Highlights

Ninja Input插件可帮助处理玩家输入,适用于Unreal Engine 5.0及更高版本。

通过第三人称模板展示如何使用Ninja Input插件处理玩家输入。

Unreal Engine 5.1及以上版本默认启用Enhanced Input插件。

演示了如何在Unreal Engine 5.0中手动启用Enhanced Input插件。

项目设置中需将Enhanced Input设置为默认输入管理器。

移除预设的输入代码,并使用Ninja Input插件重新创建输入功能。

如何为角色添加Ninja Input管理器组件以处理输入事件。

介绍如何访问Ninja Input插件的数据资产。

讲解如何使用预配置的输入映射上下文和移动处理器来实现角色移动。

介绍了输入事件列表、输入映射上下文和输入处理器的基本概念。

展示了如何通过输入处理器处理多个输入动作,如移动、查看和跳跃。

使用Ninja Input插件中的处理器可以在不同项目和角色之间复用代码。

演示了如何添加多个输入处理器来控制角色移动、旋转相机和跳跃功能。

展示了所有原始输入控制的重新实现,确保角色的移动、相机旋转和跳跃功能恢复正常。

最后清理了项目设置中的原始输入动作,为进一步扩展功能做好准备。

Transcripts

play00:00

hello Uriel from Ninja bear Studio here

play00:02

I'd like to give you an overview of the

play00:04

Ninja input plugin that's available in

play00:06

the Unreal Engine Marketplace

play00:09

this plugin was built to help handling

play00:10

player input while using the new

play00:12

enhanced input from a real engine in the

play00:15

source video let's look at some of its

play00:16

basic features by updating the third

play00:18

person template

play00:20

let's get started by creating a new

play00:22

project based on the third person

play00:24

template using blueprints no need to add

play00:27

the starter content I'll just name it

play00:29

Ninja input Labs but feel free to name

play00:31

it any way you'd like

play00:33

regarding the engine version since 5.1

play00:36

unreal uses the enhanced input plugin as

play00:38

the default input manager but in this

play00:40

video I'll be using 5.0 so we can check

play00:42

how to enable that if necessary

play00:46

now that we have our project let's hit

play00:48

play and do a quick recap on what it

play00:50

does we can move the character around

play00:52

move the camera and jump as I mentioned

play00:55

earlier the goal here is to replicate

play00:57

this Behavior using the ninja input

play01:01

the first thing we need to do is to go

play01:03

to the plugins Tab and then look for the

play01:05

enhanced input let us activate it and

play01:07

don't worry about the beta message and

play01:09

while we're here let us go ahead and

play01:11

activate the ninjap input plugin too and

play01:13

then restart the engine

play01:20

now back in the project let's set the

play01:23

enhanced input as the default input

play01:25

manager to do that all we need to do is

play01:27

to go to the project settings window

play01:28

input category and then change the

play01:31

default input classes

play01:39

if we open our character blueprint we'll

play01:41

find some code to handle the inputs that

play01:43

are pre-configured in the project

play01:50

we can simply remove them as we replace

play01:52

them with our plugin

play01:57

play our character won't respond to any

play02:00

Keys which makes sense as we just

play02:02

removed all the input handling code we

play02:04

are ready to start recreating that

play02:06

functionality using the ninja input so

play02:07

let's add the input manager component to

play02:10

the character

play02:19

before going further we'll need to go to

play02:21

the content browser and enable the

play02:23

engine content that's necessary so we

play02:26

can access some of the Ninja plugins

play02:27

data assets

play02:31

going back to the components properties

play02:33

we'll find a few attributes in there and

play02:35

we'll go through them soon enough

play02:37

for now let's just set the input context

play02:39

mapping provided by the plugin and the

play02:42

move Handler

play02:45

let's hit play one more time and see

play02:47

what we just did the character is moving

play02:49

again that's great but we still need to

play02:52

do something about the camera and the

play02:54

jump button those are still broken

play02:58

first let's break down what just

play03:00

happened there back to the component's

play03:02

properties panel there are a few things

play03:04

we should talk about

play03:08

the first property is the list of events

play03:10

that will be tracked then we have the

play03:12

input mapping contexts that will be

play03:14

registered and finally the available

play03:16

handlers that our component can use

play03:21

starting with the events these values

play03:23

are defined by the enhanced input plugin

play03:25

we are just telling our component that

play03:27

we would like to track them so we can

play03:29

forward input data to any related

play03:31

handlers

play03:33

as for the input mapping contexts the

play03:36

component needs at least one it will

play03:39

register them with enhanced input

play03:40

subsystem using the order of entries as

play03:43

their priority highest first

play03:47

here if we open the data asset we

play03:50

configured a moment ago we'll find that

play03:52

it has a few pre-configured input

play03:54

actions including move look and jump

play03:57

which are the ones that we need don't

play03:59

worry about the others for now

play04:01

also keep in mind that we would usually

play04:04

create a new input mapping context

play04:06

specific to our project or even many but

play04:09

for this quick example this one will

play04:11

work just fine

play04:13

back to the component's properties we

play04:16

have the list of input handlers an input

play04:19

Handler is a small piece of code solely

play04:21

responsible for dealing with one or many

play04:24

mapped input actions

play04:27

we can have many of those and they can

play04:30

be reused by multiple characters or

play04:32

across different projects

play04:34

if we expand the list we'll find a

play04:37

collection of handlers available and you

play04:39

can also create new ones

play04:42

most handlers will have a few properties

play04:44

that adjust the way they operate our

play04:47

move Handler for example has some

play04:49

specific and default properties

play04:51

let's check the most important ones

play04:56

the action is already mapped to the

play04:58

proper data asset that was also

play05:00

registered in our mapping context

play05:02

the events are a subset of the once

play05:05

tracked by the component itself that

play05:07

would be applicable for our specific use

play05:09

case

play05:11

as you can see we have the triggered and

play05:14

ongoing events so this Handler will

play05:17

execute on each frame while any of the

play05:19

movement input buttons are down

play05:23

let's go ahead and add two more handlers

play05:25

then the look Handler and the character

play05:28

jump Handler

play05:29

they are also pre-configured with the

play05:31

proper input actions and events

play05:38

if we hit play now all the original

play05:41

inputs are functioning again as you can

play05:43

see I can move the character rotate the

play05:46

camera and jump

play05:48

all these controls are being triggered

play05:50

by the enhanced input system and handled

play05:52

by the ninja input plugin

play05:55

now that we made sure everything is

play05:57

working as it should the last thing to

play05:59

do in this video is to go back to our

play06:01

project settings input and get rid of

play06:04

the original actions as they are not

play06:06

necessary anymore

play06:08

great now we're ready to expand this

play06:11

further and in the next video I like to

play06:13

show you how to implement crouching and

play06:16

aiming

play06:17

see you soon

Rate This

5.0 / 5 (0 votes)

Étiquettes Connexes
虚幻引擎忍者输入玩家操作增强输入蓝图角色控制游戏开发输入管理插件使用教程
Besoin d'un résumé en anglais ?