Professional Documents
Culture Documents
Розділ 3 v1
Розділ 3 v1
Рис. 3.4. Зміна налаштувань для Android (Edit - Project Settings - XR Plugin
Manager).
Рис. 3.5. Зміна налаштувань для Windows, Linux, Mac (Edit - Project Settings -
XR Plugin Manager).
ДОДАТКИ
Додаток А
(налаштування шолому)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class HandPresence : MonoBehaviour
{
private List<InputDevice> devices = new List<InputDevice>();
// Start is called before the first frame update
void Start()
{
TryInitialize();
}
// Update is called once per frame
void Update()
{
if(devices.Count == 0)
{
TryInitialize();
}
}
private void TryInitialize()
{
InputDevices.GetDevices(devices);
if (devices.Count == 0)
{
return;
}
foreach (var item in devices)
{
Debug.Log("My log, item name: " + item.name + " item characteristics: " +
item.characteristics);
} }}
Додаток В
(лістинг скрипта FireBullet)
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.XR;
public class Hand : MonoBehaviour
{
//Stores handPrefab to be Instantiated
public GameObject handPrefab;
//Stores what kind of characteristics we're looking for with our Input Device
when we search for it later
public InputDeviceCharacteristics inputDeviceCharacteristics;
//Allows for hiding of hand prefab if set to true
public bool hideHandOnSelect = false;