# VR 遊戲應用於自閉症兒童程式總覽 ###### tags: `程式` [TOC] ## 專案製作參考資源一覽 [專案製作參考資源一覽](https://hackmd.io/@vrforautism/HyE3anWbo) ## Google cloud platform 紀錄 ### NuGet 設定 [Google Cloud API 研究](/S13ygrN8RamjKEaRzn2Pvg) NuGet,基本上市面上的 IDE 都具備把此介面呼叫出來的功能 Visual Studio 的範例: Project/Manager NuGet Packages  之後就可以顯示此介面去設定版本  ### GCP 設定   點進去之後可以設定信用卡 交接時要提供其中一位的信用卡來使用 or 換別的服務     建立了之後會會產生一個 Json 檔,改名成 gcp_credentials,不要公開出去,不然會被盜用 ## PC 與 VR 環境 ### PC 作為無法接 VR 設備時,可以拿來測試的環境 ### VR 這兩張圖片的設定要開起來,不然 VR 設備不會開起來   ## Yarn spinner https://hackmd.io/CRKnVGVlSvydLcxsiVOY-g ## SteamVR [SteamVR 文件](https://hackmd.io/XNudw9WlRmWqfDQEnQoqFw) ## UniStorm * 天氣編輯器  * 時間調整  ## 小孩/夥伴/氣球資料設定(存檔資料) ChildInfoData  SceneData  ## 其他 ### Bug * 小夥伴顯示的方向錯誤 ```csharp using UnityEngine; public class PartnerView : MonoBehaviour { private GameObject partner; [SerializeField] private float yRotation; //改為自訂方向 public void Initialize(GameObject partner) { this.partner = partner; LoadPartner(); } private void LoadPartner() { GameObject visuals = Instantiate(partner); visuals.transform.SetParent(this.transform); visuals.transform.localPosition = Vector3.zero; visuals.transform.rotation = Quaternion.identity; visuals.transform.rotation = new Quaternion(0f, yRotation, 0f, 0f); } } ``` * Yarn spinner 的 Google.Protobuf 與原本 UnityGoogleStreamingSpeechToText 提供的 Google.Protobuf 有衝突 * 後來決定   * 畫面抖動問題 * UniTask 跟 sync update * 待機在顯示文字會自己跳下一個選擇 ```csharp! public class VROptionView : UnityEngine.UI.Selectable, ISubmitHandler, IPointerClickHandler, IPointerEnterHandler { private string m_NoResult = "沒反應"; //預設小孩沒反應的值 private void Update() { if (m_CurrentSeconds < m_MaxSeconds && !m_IsSelected) { m_CurrentSeconds += Time.deltaTime; m_Result = m_VoiceSystem.GetSoundText(); } else if (m_CurrentSeconds > m_MaxSeconds && !m_IsSelected) { if (m_LineText.Contains(m_Result) && m_Result.Length != 0) //不能寫 == 或 equal { Debug.Log("Contain " + m_LineText); InvokeOptionSelected(); ``` * 語音延遲問題 * 角色還沒到移動點就被傳送到雲霄飛車的 bug ```csharp! using Assets.Scripts.YarnSpinner_Extends; using System.Collections; using UnityEngine; using UnityEngine.Playables; public class PlayFacilityTrigger : MonoBehaviour { [SerializeField] private PlayableDirector playableDirector; [SerializeField] private Transform m_NextPlayerTransform; [SerializeField] private float seconds = 30f; private Transform m_PlayerTransform; private void OnTriggerEnter(Collider other) { // if (other.GetComponent<VRPlayerCharacter>()) { Debug.Log("Have VRPlayerCharacter."); if (other.GetComponent<VRPlayerCharacter>().Parent != null) { m_PlayerTransform = other.GetComponent<VRPlayerCharacter>().Parent.gameObject.transform; } else { m_PlayerTransform = other.gameObject.transform; } //發現 bug 後擺放的位置 playableDirector.Play(); StartCoroutine(TimelineComplete()); } //原本擺放的位置 //playableDirector.Play(); //StartCoroutine(TimelineComplete()); } private IEnumerator TimelineComplete() { yield return new WaitForSeconds(seconds); m_PlayerTransform.position = m_NextPlayerTransform.position; } } ``` * VR移動地板的顯示會一下顯現一下消失 * 將VR移動地板的 Y 軸設在一般草地地板的上方 * 語音文字辨識錯誤的問題 * VR畫面與實際遊戲人物物件位置偏移,發生原因在於排隊錯誤無觸發劇情,且之後的時,但可能先前因為一直無法觸發,小孩多次超出VR保護範圍,造成偏移 * ? * VR 位置會因為流程而卡在一個範圍無法移動(舊專案 bug) * 現改成可以自由移動 * UniStorm 的 PC 與 VR platform 切換沒有順利運作 ```csharp! namespace UniStorm.Utility { [CustomEditor(typeof(UniStormSystem))] [System.Serializable] public class UniStormEditor : Editor { public override void OnInspectorGUI() { if (GUILayout.Button("Apply Platform Settings")) { if (EditorUtility.DisplayDialog("Platform Controller", "Are you sure you want to apply the selected platform? This process cannot be undone.", "Yes", "Cancel")) { if (self.PlatformType == UniStormSystem.PlatformTypeEnum.Desktop) { ... } else if (self.PlatformType == UniStormSystem.PlatformTypeEnum.VR) { ... GUIUtility.ExitGUI(); //增加此行程式碼後 Editor 才能正常運作 } ... ``` * SteamVR 的程式會一直跳預設視窗顯示 ```csharp! namespace Valve.VR { [InitializeOnLoad] public class SteamVR_UnitySettingsWindow : EditorWindow { ... const bool recommended_ShowUnitySplashScreen = true; //原本的值為 false,改成 true 就不會在跳出來了 ... ``` * Google cloud platform 洩漏的事情 * git hook * git ignore ### 優化 * 需要搭乘的遊樂設施,停止時間要長一點,不然小孩會無法搭上去。另外,空轉時間要縮短,避免小孩等待太久 * 一些位置的判定點不好移動 ### 專案狀況排除 Q: 有部分設定壞掉,無法用 Unity 重開的方式去 A:點擊 Assets/Reimport 來 reimport 整個專案  ## 差異 增強遊戲畫面 天氣編輯器 * 時間系統 語音辨識 文本編輯 音樂 兒童測試 遊玩體驗增強 ## 參考資料 https://github.com/ActiveNick/Unity-Text-to-Speech https://github.com/oshoham/UnityGoogleStreamingSpeechToText https://github.com/naudio/NAudio
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up