Обзор классов и компонентов
When you first open your project based on the VR Template and see a lot of different classes and components, you might get confused a bit. So, let's learn a bit more about the template structure. All components that implement the basic VR functionality are assigned to the corresponding nodes organized in the hierarchy with the vr_layer root node (see the picture below):Когда вы впервые открываете свой проект на основе VR Template и видите много разных классов и компонентов, вы можете немного запутаться. Поэтому давайте немного познакомимся со структурой шаблона. Для простоты понимания и удобства использования, все компоненты, реализующие базовый VR-функционал, назначены на соответствующие ноды, которые организованы в иерархию с корневой нодой vr_layer (см. схему ниже).
VRPlayer ComponentКомпонент VRPlayer#
A player is represented by the hierarchy of nodes with the vr_player node in the root (a Player Dummy camera), to which the VRPlayer component is assigned. The component implements the player's logic. The child nodes of vr_player represent models of HMDs and controllers, to which all necessary components are assigned to configure interactions and main parameters.Игрок представлен иерархией ноды vr_player (камера Player Dummy) с назначенным компонентом VRPlayer, реализующим логику игрока. Дочерними нодами vr_player являются модели шлема, контроллеров, на которые назначены все необходимые компоненты для настройки взаимодействий и основных параметров.
InputSystem ComponentКомпонент VRInput#
VRInput – основной компонент реализующий работу с пользовательским вводом, в нем содержатся списки возможных устройств, контроллеров, элементов управления (контроллеры + общие), обработчики событий и т.д. Параметры ввода для каждого конкретного типа оборудования, функционал опроса состояния элементов управления и т.д. реализованы в соответствующих классах (PCInput, ViveInput, OculusInput).
HeadController and HandController ComponentsКомпонент VRHeadController#
Работа самих устройств реализована в соответствующих классах унаследованных от VRHeadController (для шлемов – ViveHeadController, OculusHeadController, PCHeadController) и VRHandController (для контроллеров – ViveHandController, OculusHandController, PCHandController).
VRMovementManager ComponentКомпонент VRMovementManager#
The VRMovementManager component is used for movement management. Different types of movements (rotating, walking, teleporting) are implemented in the components inherited from the base VRBaseMovement component (TurnMovement, WalkMovement, TeleportationMovement + implementation of movements for the VR-emulation mode with keyboard control).VRMovementManager – компонент реализующий управление движением. Различные типы движения (повороты, ходьба, телепортирование) реализованы в компонентах унаследованных от базового VRBaseMovement (TurnMovement, WalkMovement, TeleportationMovement + реализация движений для режима VR-эмуляции с управлением от клавиатуры).
VRInteractionManager ComponentКомпонент VRInteractionManager#
The VRInteractionManager component is used for interactions management. Different types of interactions are implemented in the components inherited from the base VRBaseInteraction component:VRInteractionManager – компонент реализующий управление взаимодействиями. Различные типы взаимодействий реализованы в компонентах унаследованных от базового VRBaseInteraction:
- VRHandMenuInteraction - interaction with the menu using controllersVRHandMenuInteraction – взаимодействие с меню при помощи контроллеров
- VRHandShapeInteraction - interaction with objects using controllers and the keyboardVRHandShapeInteraction – взаимодействие с объектами при помощи контроллеров и клавиатуры
- VRPCHeadMenuInteraction - interaction with the menu for the VR-emulation mode with keyboard controlVRPCHeadMenuInteraction – взаимодействие с меню для режима VR-эмуляции с управлением от клавиатуры)
VRBaseInteractable ComponentКомпонент VRBaseInteractable#
VRBaseInteractable is a base component for all interactive objects (objects you can interact with). It defines the main interactions: here you specify the available actions with the object. You can also add your own interaction type.VRBaseInteractable – это базовый класс для всех интерактивных объектов (тех, с которыми вы можете взаимодействовать). Другими словами, он определяет базовый набор взаимодействий: здесь вы указываете, что пользователь может делать с вашим объектом. Здесь же можно добавить и собственный тип взаимодействия.
The following components are inherited from VRBaseInteractable:Следующие классы компонентов унаследованы от VRBaseInteractable:
VRTransformMovableObject | This component type can be used for all objects that can be grabbed, held, and thrown (it can be a ball, a pistol, whatever you can take, carry and drop).Этот тип компонента можно использовать для всех объектов, которые можно схватить, удерживать и бросить (это может быть мяч, пистолет, все, что вы можете взять, нести и бросить). |
---|---|
VRKinematicMovableObject | This component type can be used for physical objects that can be grabbed, held, and thrown (it can be a ball, a pistol, whatever you can take, carry and drop).Этот тип компонента можно использовать для физических объектов, которые можно схватить, удерживать и бросить (это может быть мяч, пистолет, все, что вы можете взять, нести и бросить). |
VRPhysicMovableObject | This component type can be used for physical objects with rigid bodies (Rigid Body) that can be grabbed, held, and thrown (it can be a ball, a pistol, whatever you can take, carry and drop).Этот тип компонента можно использовать для физических объектов с твердым телом (Rigid Body), которые можно схватить, удерживать и бросить (это может быть мяч, пистолет, все, что вы можете взять, нести и бросить). |
VRObjectHandle | This component type can be used for all objects that can be turned or moved while being held (various handles, levers, valves, etc.).Этот тип компонента можно использовать для всех объектов, которые можно поворачивать или перемещать при удерживании (различные ручки, рычаги, клапаны и т. д.). |
VRObjectSwitch | This component type can be used for all objects that can be switched by grabbing (all sorts of buttons and on-off switches, including rotary ones). It can be used in combination with the VRNodeSwitchEnableByGrab component for additional effects.Этот тип компонента можно использовать для всех объектов, которые можно переключать захватом (всевозможные кнопки и переключатели, включая поворотные). Может использоваться в сочетании с компонентом VRNodeSwitchEnableByGrab для обеспечения дополнительных эффектов. |
VRNodeSwitchEnableByGrab | This component type is used to control enabling/disabling of one or more nodes when grabbed.Этот тип компонента позволяет управлять включением/выключением одной или множества нод при захвате. |
VRLaserPointer | This component enables casting a laser ray by the object. The laser pointer node has 2 components assigned: VRTransformMovableObject and VRLaserPointer.Этот компонент позволяет направить на объект лазерный луч. К объекту лазерной указки прикреплены компоненты VRTransformMovableObject и VRLaserPointer. |