类和组件概述
When you open your project based on the VR Sample for the first time and see a lot of different classes, you might get confused a bit. But let's take a quick look at each of them to see what they actually do and how they are connected.当您第一次基于VR Sample打开项目并看到很多不同的类时,您可能会感到困惑。 但是,让我们快速浏览一下它们中的每一个,看看它们实际上做了什么以及它们是如何连接的。
VRInteractable ClassVRInteractable类#
This is a base class for all objects that you can interact with. It defines a basic set of interactions, in other words: here you define what can a user do with your object. You can add your own type of interaction here.这是您可以与之交互的所有对象的基类。 它定义了一组基本的交互,换句话说:在这里您定义了用户可以对您的对象做什么。 您可以在这里添加您自己的交互类型。
The following component classes are inherited from the VRInteractable:以下组件类继承自VRInteractable:
VRPlayer ClassVRPlayer类#
This is a base class for all players. It contains declaration of baseline controls, common basic player operations, callback management etc.这是所有玩家的基类。 它包含基线控件的声明,常见的基本玩家操作,回调管理等。
The following component classes are inherited from the VRPlayer:以下组件类继承自VRPlayer:
VRPlayerPC | This component implements a player with standard PC input devices (keyboard + mouse or Xbox360 controller) for VR emulation and contains all related settings and methods.该组件实现了一个带有标准PC输入设备(键盘+鼠标或Xbox360控制器)的玩家,用于VR仿真,并包含所有相关设置和方法。 |
---|---|
VRPlayerVR | This is a base class implementing common functionality for supported VR devices and contains their common parameters. The UltraleapHandController class is inherited from VRPlayerVR and available when the Ultraleap plugin is loaded.这是一个为支持的VR设备实现通用功能的基类,并包含它们的通用参数。 UltraleapHandController类继承自VRPlayerVR,并在加载Ultraleap插件时可用。 |
VRPlayerSpawner ClassVRPlayerSpawner类#
This class registers all VRPlayer components in the Component System. It checks that VR is initialized and spawns the VRPlayerVR.此类注册组件系统中的所有VRPlayer组件。 它检查VR是否已初始化并生成VRPlayerVR。
MenuBaseGUI ClassMenuBaseGUI类#
This is a base class for all graphic user interfaces (GUI).这是所有图形用户界面(GUI)的基类。
The following component classes are inherited from the MenuBaseGUI:以下组件类继承自MenuBaseGUI:
Framework框架#
Framework includes the Component System which implements the core functionality of components and a set of utility classes and functions used for playing sounds, auxiliary math and 3d math functions, callback system implementation.框架包括实现组件核心功能的组件系统和一组用于播放声音的实用程序类和函数,辅助数学和3d数学函数,回调系统实现。
Triggers ClassTriggers类#
Triggers is a framework class used to mark room obstacles for the VR Player (e.g. room walls, objects, etc.) and give a warning if there is an obstacle on the way (as the player gets closer to an obstacle, controllers' vibration becomes more intense).Triggers是一个框架类,用于为VR玩家标记房间障碍物(例如房间墙壁、物体等),并在途中有障碍物时发出警告(随着玩家越来越接近障碍物,控制器的振动变得更加强烈)。
You can simply create primitives for walls and objects in your room and add them as children to the node dummy named Obstacles, which is a child of the VR dummy node (see the hierarchy in the Editor below).您就可以为房间中的墙壁和对象创建基元,并将它们作为子节点添加到名为Obstacles节点虚拟中,该节点是VR dummy node的子节点(请参阅下面编辑器中的层次结构)。
All children of the Obstacles node will be automatically switched to invisible mode and will be used only to inform the player and prevent collisions with objects in the real room.Obstacles节点的所有子节点将自动切换到不可见模式,仅用于通知玩家并防止与真实房间中的物体发生碰撞。