ARã«é¢ããUnityã®è¨äºã¯ãç¾å®ç©ºéã«ä½ãã¢ãã«ãé
ç½®ãã¦ã¿ããã¨ãã£ããã¥ã¼ããªã¢ã«ã§çµããè¨äºãå¤ãããã®å
ã«ãããªãªã¼ã¹ã«åãããã¦ãã¦ããããä¸ã«ããã»ã©ããã¾ããã§ããã
ãªã®ã§ä»åã¯ARã²ã¼ã ããªãªã¼ã¹ããã«ãããã試è¡é¯èª¤ã§ææ¡ããäºããªãªã¼ã¹å¾ã«æ°ä»ããäºãTipså½¢å¼ã§æ¸ãã¾ãã
â»AndroidåãARã²ã¼ã éçºãããã¦ãã¦ãªãããiOSã«é¢ãã¦ã¯åèæ
å ±ç¨åº¦ããããã¾ãã
ãªãªã¼ã¹ããARã²ã¼ã
R18ç¦ã®ã²ã¼ã ã§ãããDLSiteã§Androidã®ã¿è²©å£²ãã¦ãã¾ã*1ãä½é¨çã§ã¯ARæ©è½ã試ããR18è¦ç´ ãç¡ãã®ã§ãããã°DLãã¦ã¿ã¦åä½ç¢ºèªãã ããã
ç°å¢
ä»åã¯ä»¥ä¸ã®ç°å¢ã§è¡ãã¾ããã
- Unity2022.3.35f1
- AR Foundation v5.1.5
- Google ARCore XR Plugin v5.1.5
- XR Core Utilities v2.3.0
- XR Plugin Management v4.4.1
- XR Simulation Environments v1.0.0
Tips
ãµãã¼ãæ©ç¨®
Androidã®å ´åã¯ARCoreæè¼æ©ç¨®ã§ãªããã°ARæ©è½ã使ããã¨ãåºæ¥ã¾ããã
Googleããµãã¼ãä¸è¦§ã以ä¸ãµã¤ãã§å
¬éãã¦ãã¾ãããã ããã®ä¸è¦§ã«ä¹ã£ã¦ç¡ãã¦ããµãã¼ãããã¦ããæ©ç¨®ããããããªã®ã§ããè¼ã£ã¦ãã°åããã©ãè¼ã£ã¦ç¡ããã°ä½é¨çã§å¿
ãä¸åº¦ã¯åä½ç¢ºèªãã¦ã¿ã¦ããã¨ãã風ã«ã¦ã¼ã¶ã¼ã¸ä¼ããã°ããããã§ãã
developers.google.com
iOSã«é¢ãã¦ã¯ä»¥ä¸ãµã¤ãã®ãæ¡å¼µç¾å®ã«å¯¾å¿ãã¦ããiOSããã¤ã¹ã¨iPadOSããã¤ã¹ã¯ãã¡ãã§ããã確èªãã ããã
www.apple.com
é®è½ç©ãèªèãã
ç¾å®ç©ºéã®å£ã人ãèªèãã¦ã¢ãã«ããæåã«ããå ´åããã®é¨åã®ã¢ãã«ãé表示ã«ããæ©è½ã§ãã
ããã対å¿ããäºã§ã¢ãã«ãå£ã«é ãããã人混ã¿ã«ç´ããããæã«æå½±ã¢ãã«ã®ç¾å®æãå¢ãã¾ãã
ARCameraã³ã³ãã¼ãã³ãã¨åãGameObjectã¸AR Occlusion Managerãã¢ã¿ããããé®è½ç©ã¨ãã¦èªèãã対象ãé
ç®å¥ã«è¨å®ããã ãã§æ©è½ãã¾ãã
ãã ãããã©ãããã©ã¼ã ãæ©ç¨®ã«ãã£ã¦å¯¾å¿å¯è½/ä¸å¯è½ãããã¾ãã
Environment DepthãBestã«ããã¨ãã«ã¡ã©ããç¾å®ä¸çã®ç©ä½ã¾ã§ã®è·é¢ãåããããã«ãªãã¾ããããã§å£ã«ã¢ãã«ãé ããäºãåºæ¥ã¾ããDepth API対å¿ãã¦ãããã©ãããªãããåè¿°ããããµãã¼ãæ©ç¨®ãã§ç«¯æ«ã対å¿ãã¦ããã確èªåºæ¥ã¾ããé対å¿ã§ããã°é®è½ç©ããã£ã¦ãé ãã¾ããã
iOS㯠LiDARã¹ãã£ãæè¼ããã¦ããå¿
è¦ããããããã§ãããiOSåãARã¢ããªã¯éçºãã¦ããªãããå®éã©ããã¯æªæ¤è¨¼ã§ãã
Human Sementationã¯iOSã®AR Kitã®æ©è½ã§ã人ãé害ç©ã¨ãã¦èªèããæ©è½ã§ãã
è
ã人ã§ã¢ãã«ãé ããã¨åå¨æãããã£ã¨å¼ãä¸ãã£ã¦å¤§å¤è¯ãã®ã§ãAndroidã ã¨ä½¿ããªãã®ãæ®å¿µã§ãã
Androidã§ARæ©è½ã使ãã®ã«å¿ é ã®ã¢ããªããã
play.google.com
ãã®ãGoogle Play éçºè
ãµã¼ãã¹(AR)ãã¢ããªãã¦ã¼ã¶ã¼ã®ç«¯æ«ã«ã¤ã³ã¹ãã¼ã«ããã¦ãªããã°ARæ©è½ã¯ä½¿ãã¾ããã
æåãããç¥ããªãã¦(Pixel2ãPixel8ã¯æåããã¤ã³ã¹ãã¼ã«æ¸ã¿ã ã£ã)ãæåã®ãã¼ã¸ã§ã³ã§ã¯ã¢ããªã¤ã³ã¹ãã¼ã«ããã¦ãããã®ãã§ãã¯ãããªãã£ãããè¬ã¨ã©ã¼ãçºçããã¦ãã¾ã
æ©ä¼æ失ããã¦ãã¾ãã¾ãããè¦ãçµé¨ã§ãã
ãªã®ã§ãARæ©è½ã«é¢ããã¨ã©ã¼ãã³ããªã³ã°ã¯ä»¥ä¸ã®ããã«è¡ã£ã¦ããã®ãç¡é£ã®ããã§ãã
async void Start() { // ARæ©è½ã使ãããã®ãã§ã㯠await StartCoroutine(checkAr()); } IEnumerator checkAr() { if ((ARSession.state == ARSessionState.None) || (ARSession.state == ARSessionState.CheckingAvailability)) { yield return ARSession.CheckAvailability(); } if (ARSession.state >= ARSessionState.Ready) { // TODO:æ£å¸¸å¦ç } else if (ARSession.state == ARSessionState.Unsupported) { // ARCoreæªæè¼ãªã©ã®ãã¼ãã¦ã§ã¢å´ã«åé¡ããã£ã¦ARæ©è½ã使ããªã // TODO:ARãµãã¼ã対象å¤ã®ã¨ã©ã¼å¦çã¯ããã«æ¸ã } else if (ARSession.state == ARSessionState.NeedsInstall || ARSession.state == ARSessionState.Installing) { // ãGoogle Play Services for ARããæªã¤ã³ã¹ãã¼ã«ãããã¯ãã¼ã¸ã§ã³ãå¤ãã®ã§ãGooglePlayããã¤ã³ã¹ãã¼ã«ãããã¯æ´æ°ãè¡ã£ã¦ããã StartCoroutine(InstallARCoreApp()); // TODO: ã¢ããªã¤ã³ã¹ãã¼ã«å¾ã¯å度ARæ©è½ã使ããããã§ãã¯ãè¡ãããã¢ããªãåèµ·åããããä¿ã } else { // TODO:ããåãããªããã©ã¨ã©ã¼ãçºçããæã®å¦ç } } /// <summary> /// ãGoogle Play Services for ARããã¤ã³ã¹ãã¼ã«ããããã«ä¿ã /// </summary> private IEnumerator InstallARCoreApp() { yield return ARSession.Install(); }
ARSession.Install() ãå¼ã³åºãã¨ä¸å³ã®ãããªã·ã¹ãã ãã¤ã¢ãã°ã表示ãããç¶è¡ æ¼ä¸ããã¨åé ã«æ¸ãããGoogle Play éçºè
ãµã¼ãã¹(AR)ãã¢ããªã®ã¹ãã¢ãã¼ã¸ãéãã¾ãã
æªã¤ã³ã¹ãã¼ã«æã®ãã¹ãã¯ãGoogle Play éçºè ãµã¼ãã¹(AR)ãã¢ããªãã¢ã³ã¤ã³ã¹ãã¼ã«ããã°è¡ãã¾ãã
ç¾å®ç©ºéã¸é ç½®ããæã«åããªãããAnkerè¨å®
ç¾å®ç©ºéã«åºç¾ãããã¢ãã«ããã®å ´æã«åºå®ãããå ´åãARAnchorã対象ã¢ãã«ã«ã¢ã¿ããããå¿ è¦ãããã¾ãããã ããããã©ã¼ãã³ã¹ã«å½±é¿ããã®ã§å¤§éã«ARAnchorãã¢ã¿ãããããå¿ è¦æå°éã«çããã®ãè¯ãããã§ãã
//ARã§è¡¨ç¤ºãããªãã¸ã§ã¯ã [SerializeField] GameObject _targetModelObj; private void spawnModel() { _targetModelObj.AddComponent<ARAnchor>(); }
ããã対å¿ããäºã§ã«ã¡ã©ã«åºãæ ããªãç¶æ ã«ãªã£ã¦ã表示座æ¨ãçãã«ãããªãã¾ãã
空éã¹ãã£ã³æã®è¦ãç®ãå¤æ´ãã
ã«ã¡ã©ã§åºã¨å¤å®ãããå ´æã«ç¾ããåºã¯ AR Plane Manager ã® Plane Prefab ã®Prefabãå·®ãæ¿ããã¨è¦ãç®ãå¤ããã¾ãã
Unity Editorä¸ã§ã®ãããã°
XR Simulation Environments ãå°å
¥ãã¦ããã°Editorä¸ã§ã·ãã¥ã¬ã¼ãåºæ¥ã¾ãã
ããã¾ã§ã·ãã¥ã¬ã¼ããªããç°å¸¸ç³»ãçºçãããåºåãã®è¯ãæã§å®æ©æ¤è¨¼ãå¿
é ã§ãã
Editorä¸ã§ç¢ºèªåºæ¥ãã®ã¯ãã©ã¤&ã¨ã©ã¼ã®ç¢ºèªãç´ æ©ãè¡ãã¦è¯ãã§ãã
1. Unityä¸ã¡ãã¥ã¼ãã Window > XR > AR Foundation > XR Environment é¸æ
2. XR Environment ãã¥ã¼ä¸ã§ãä¸å³ã®Backyard_45ftx40ftãã«ãã¦ã³ããæãã好ããªãã¹ãããããé¸ã¶
3. Play Modeããã¨é¸ãã ãããä¸ã§ãã¹ããè¡ãã