Custom Input Actions With The XR Interaction Toolkit using Unity's New Input System Package

Опубликовано: 14 Июнь 2024
на канале: XR Terra Class
3,125
74

This video shows you how to detect your own inputs, such as buttons or joystick controls, by adding your own custom input action to the XRI Default Input Action asset and subscribing to their events through a C# script.

XRTerra Links:
Programs and Courses: http://www.xrterra.com/programs
Newsletter Signup: https://www.xrterra.com/mailing-list-...

Your First VR Scene with the XR Interaction Toolkit in Unity:    • Your First VR Scene with the XR Inter...  
C# Events in Unity:    • C# Events in Unity  
XR Device Simulator 2.2.0 And Earlier:    • XR Device Simulator 2.2.0 And Earlier  

00:00 Intro and prerequisites
00:52 VR Scene setup
01:45 Explaining our exercise
02:14 Opening the XRI Default Input Action Asset
02:51 Creating a new Input Action
03:12 Binding the button action path
03:56 Adding an interaction condition
04:45 Creating a script
05:15 using UnityEngine.InputSystem namespace
05:35 Referencing the Input Action Reference
05:50 Explaining Button action events
06:20 Subscribing to the button's events
06:58 Creating the subscribed function
07:13 Receiving InputAction.CallbackContext parameters
08:12 Toggling a Mesh Renderer component
08:40 Creating a cube to toggle
09:13 Assigning button Input Action reference in Inspector
09:46 Finding our Input Action asset in Project window
10:02 Testing out our button action
10:49 Lets use the thumbstick to move our cube around
11:13 Creating the custom thumbstick input action
11:56 Changing the Action Type
12:13 Setting the Control Type to Vector2
12:49 Binding the thumbstick action path
13:49 Declaring a new Input Action Reference
13:59 Subscribing to the thumbstick action
14:40 Extracting information from the CallbackContext type
15:07 context.ReadValue
15:39 Putting extracted vector into the Console
16:02 Assigning thumbstick Input Action reference in Inspector
16:22 Debugging thumbstick inputs with the headset
17:13 Testing out thumbstick output in the Console
17:57 We already have a reference to the cube
18:14 Describing what we're about to do
18:35 Converting Vector2 to Vector3
19:22 Moving the cube by our new vector
19:59 Testing out a very fast cube
20:28 We'd probably multiply the vector times Time.deltaTime
20:39 Summary

Instructor: Gregory Osborne


Смотрите видео Custom Input Actions With The XR Interaction Toolkit using Unity's New Input System Package онлайн без регистрации, длительностью часов минут секунд в хорошем качестве. Это видео добавил пользователь XR Terra Class 14 Июнь 2024, не забудьте поделиться им ссылкой с друзьями и знакомыми, на нашем сайте его посмотрели 3,125 раз и оно понравилось 74 людям.