ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2023ǯ01·î21Æü(ÅÚ) 23:59:48ÍúÎò
¡¡£³¡¥Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë ¡¡£´¡¥AR Camera ¤È Main Camera ¤È¤ò¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ë¤è¤Ã¤Æ¼«Æ°Åª¤ËÀÚ¤êÂؤ¨¤ëµ¡Ç½¤ò¼ÂÁõ¤¹¤ë
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦¥×¥é¥Ã¥È¥Õ¥©¡¼¥à°Í¸¥³¥ó¥Ñ¥¤¥ë¡¡¡Ý¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ë¹ç¤ï¤»¤Æ½èÍý¤òÊѤ¨¤ëµ¡Ç½¡Ý
¡¡¸½ºß¤Ï¥²¡¼¥à¤ÎÉñÂæ¤È¤Ê¤ë¥Õ¥í¥¢¤ä¥Ú¥ó¥®¥ó¤Ê¤É¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ê¤É¤Ï¤¹¤Ù¤ÆºÇ½é¤«¤éÇÛÃÖ¤µ¤ì¤¿¾õÂ֤ǥ²¡¼¥à¤¬¼Â¹Ô¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡
¡¡AR ¤Î¾ì¹ç¡¢Ê¿Ì̤ò´¶ÃΤ·¤¿¤¢¤È¤Ë¡¢¤³¤ì¤é¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÀ¸À®¤¹¤ë¤è¤¦¤Ë¤·¤¿¤¤¤Î¤Ç¡¢
¥«¥á¥é°Ê³°¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ä¤¤¤Æ¤Ï¡¢¥Õ¥©¥ë¥ÀÌò¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¿·¤·¤¯£±¤ÄºîÀ®¤·¤Æ¡¢¤½¤ÎÃæ¤Ë¤¹¤Ù¤Æ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤ÆÇÛÃÖ¤¹¤ë¤è¤¦¤Ë¤·¤Þ¤¹¡£
¥«¥á¥é¤ò½ü³°¤·¤Æ¤¤¤ë¤Î¤Ï¡¢¥¨¥Ç¥£¥¿¡¼´Ä¶¤È¼Âµ¡´Ä¶¤Ç¡¢ÍøÍѤ¹¤ë¥«¥á¥é¤¬ MainCamera ¤È AR Camera ¤È¤Ç°Û¤Ê¤ë¤¿¤á¤Ç¤¹¡£
¡¡
¡¡¥Ò¥¨¥é¥ë¥¡¼¤Î¶õ¤¤¤Æ¤¤¤ë¾ì½ê¤Ç±¦¥¯¥ê¥Ã¥¯¤ò¤·¤Æ¥á¥Ë¥å¡¼¤ò³«¤¡¢Create Empty ¤òÁªÂò¤·¤Þ¤¹¡£
¿·¤·¤¤¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬ºîÀ®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢Ì¾Á°¤ò Stage ¤ËÊѹ¹¤·¤Þ¤¹¡£
¡¡AR ¥·¡¼¥óÍѤˡ¢¥²¡¼¥àÆâ¤Î¥¹¥Æ¡¼¥¸ÍѤΥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È·²¤ò¤¹¤Ù¤Æ Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤·¤Þ¤¹¡£
¡¡AR Session ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¢AR Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¢MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È°Ê³°¤Î¤¹¤Ù¤Æ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò
Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤½¤Î¸å¡¢¥×¥ì¥Õ¥¡¥Ö¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£¤¿¤À¤·¡¢¤Þ¤À¥Ò¥¨¥é¥ë¥¡¼¤«¤éºï½ü¤Ï¤»¤º¤Ë¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡ºÇ¸å¤Ë¡¢MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¹¥¤¥Ã¥Á¤òÆþ¤ì¤Æ¡¢¥¢¥¯¥Æ¥£¥Ö¾õÂÖ¤ËÀÚ¤êÂؤ¨¤Æ¤¯¤À¤µ¤¤¡£
¥Ò¥¨¥é¥ë¥¡¼²èÁü(»²¹Í²èÁü¡£¼«Ê¬¤Î¥Ò¥¨¥é¥ë¥¡¼¤Ë±è¤Ã¤Æºî¶È¤·¤Æ¤¯¤À¤µ¤¤)
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï´°À®¤Ç¤¹¡£
¡¡AR ¥²¡¼¥à¤Î¾ì¹ç¡¢¥¨¥Ç¥£¥¿¡¼¤Ç¤Î¥Ç¥Ð¥Ã¥°¤À¤±¤Ç¤Ï¤Ê¤¯¡¢¼Âµ¡(¥¹¥Þ¥ÛüËö)¤Ç¤Î¥Ç¥Ð¥Ã¥°¤¬É¬¿ÜÍ×·ï¤Ë¤Ê¤ê¤Þ¤¹¡£
¤¿¤À¤·¡¢¥¨¥Ç¥£¥¿¡¼¤Ç¥Ç¥Ð¥Ã¥°¤ò¹Ô¤¦¾ì¹ç¤Ë¤Ï AR Camera ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò̵¸ú²½¤·¤¿¤ê¡¢¤¢¤ë¤¤¤ÏµÕ¤Ë
¼Âµ¡¤Ç¥Ç¥Ð¥Ã¥°¤ò¹Ô¤¦¾ì¹ç¤Ë¤Ï¥Ó¥ë¥ÉÁ°¤ÎÁ°¤Ë MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò̵¸ú²½¤·¤¿¤ê¤È¡¢¼ê´Ö¤Èºî¶È¤¬Áý¤¨¤Æ¤¤¤Þ¤¹¡£
¡¡¤½¤³¤Ç¡¢¥²¡¼¥à¤òµ¯Æ°¤·¤¿ºÝ¤Ë¡¢¤É¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à(¥²¡¼¥à´Ä¶)¤Ç¥²¡¼¥à¤òµ¯Æ°¤·¤Æ¤¤¤ë¤«¤Ë¹ç¤ï¤»¤Æ¡¢
ÍøÍѤ¹¤ë¥«¥á¥é¤ò¼«Æ°Åª¤ËÀÚ¤êÂؤ¨¤ëµ¡Ç½¤ò¼ÂÁõ¤·¡¢Àè¤Û¤É¤Î¼êÆ°¤Ç¥«¥á¥é¤ÎÀÚ¤êÂؤ¨¤ò¹Ô¤¦Éôʬ¤ò¼«Æ°²½¤·¤Þ¤¹¡£
¼ê´Ö¤¬¾Ê¤±¤ë¤À¤±¤Ç¤Ï¤Ê¤¯¡¢Ìµ¸ú²½¤·Ëº¤ì¡¢Í¸ú²½¤·Ëº¤ì¤òËɻߤ¹¤ë¤³¤È¤Ë¤â¤Ä¤Ê¤¬¤ê¤Þ¤¹¡£
¡¡Unity ¤Ë¤Ï¥×¥é¥Ã¥È¥Õ¥©¡¼¥à°Í¸¥³¥ó¥Ñ¥¤¥ë¤È¤¤¤¦µ¡Ç½¤¬¤¢¤ê¡¢¤³¤Á¤é¤òÍøÍѤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢µ¯Æ°¤·¤Æ¤¤¤ë¥²¡¼¥à´Ä¶¤Ë±þ¤¸¤Æ
¥«¥á¥é¤òÀ©¸æ¤¹¤ë½èÍý¤ò¼ÂÁõ¤·¤Æ¤¤¤¤Þ¤¹¡£
¡¡Unity¤Ç¤Ï¥×¥é¥Ã¥È¥Õ¥©¡¼¥à(PC¡¢Android¤Ê¤É¤ÎÆ°ºî¤¹¤ë´Ä¶)¤Ë¹ç¤ï¤»¤Æ½èÍý¤òÊѹ¹¤¹¤ëµ¡Ç½¤¬¤¢¤ê¡¢¤½¤ì¤ò¥×¥é¥Ã¥È¥Õ¥©¡¼¥à°Í¸¥³¥ó¥Ñ¥¤¥ë¤È¸Æ¤Ó¤Þ¤¹¡£
void Awake() { # if UNITY_EDITOR arCamera.SetActive(false); # elif UNITY_ANDROID || UNITY_IOS editorCamera.SetActive(false); stage.SetActive(false); # endif }
¡¡#if¡¡¥×¥é¥Ã¥È¥Õ¥©¡¼¥à̾(Unity¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë)¤ò»ØÄꤹ¤ë¤³¤È¤Ç¡¢¤½¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¾ì¹ç¤Î¤ß»ØÄꤷ¤¿½èÍý¤ò¹Ô¤¦¤è¤¦¤ËÀßÄê¤Ç¤¤Þ¤¹¡£
¤Þ¤¿ if / else ʸ¤ÈƱ¤¸¤è¤¦¤Ë #elif ¤òÄɲ乤롢¤¢¤ë¤¤¤Ï else ʸ¤ÈƱ¤¸¤è¤¦¤Ë #else ¤òÄɲ乤뤳¤È¤ÇÊ̤Υץé¥Ã¥È¥Õ¥©¡¼¥à¤Î¾ì¹ç¤Îʬ´ô¤òºîÀ®¤Ç¤¤Þ¤¹¡£
¤½¤Î¤¿¤á»ÈÍÑÊýË¡¤ÏÄ̾ï¤Îifʸ¤ÎÀ©¸æ¤ÈƱÍͤǤ¹¡£
¡¡º£²ó¤Î¥±¡¼¥¹¤Ç¤Ï¡¢¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤¬ UnityEditor¤Î¾ì¹ç(PC¤â´Þ¤ß¤Þ¤¹)¤Ë¤Ï¡¢arCamera ÊÑ¿ô¤ËÂФ·¤Æ SetActive ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ëµ½Ò¤·¤Æ¤¤¤Þ¤¹¡£
¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤¬ elif¡¢¤Ä¤Þ¤ê¡¢UnityEditor °Ê³°¤Ç¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¤¤¤ë¾ì¹ç¤Ç¤¢¤ê¡¢¤«¤Ä Andorid ¤« iOS ¤Î¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Î¾ì¹ç¤Ë¤Ï¡¢
editorCamera ÊÑ¿ô¤È stage ÊÑ¿ô¤ËÂФ·¤Æ SetActive ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤¹¤ë¤è¤¦¤Ëµ½Ò¤·¤Æ¤¤¤Þ¤¹¡£
¡¡¤³¤Îµ¡Ç½¤òÍøÍѤ¹¤ë¤³¤È¤Ë¤è¤ê¡¢£±¤Ä¤Î¥á¥½¥Ã¥ÉÆâ¤Ç¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ë±þ¤¸¤¿½èÍý¤òʬ´ô¤·¤Æµ½Ò¤Ç¤¤Þ¤¹¡£
º£²ó¤Ï¡¢Unity ¥¨¥Ç¥£¥¿¡¼(PC)¤Ë¤ª¤¤¤Æ¥²¡¼¥à¤ò¼Â¹Ô¤·¤¿¾ì¹ç¤Ë¤Ï¡¢MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÍøÍѤǤ¤ë¾õÂ֤ˤ·¡¢
¥¹¥Þ¥ÛüËö¤Ç¥²¡¼¥à¤ò¼Â¹Ô¤·¤¿¾ì¹ç¤Ë¤Ï AR ¤Î¥«¥á¥é¤òÍøÍѤǤ¤ë¾õÂ֤ˤ·¤Æ¤¤¤Þ¤¹¡£
¡¡¤Þ¤¿¡¢¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ë¤è¤Ã¤ÆÆþÎϤÎÊý¼°¤¬°Û¤Ê¤ë¾ì¹ç¤Ë¤âŬÍѤ¹¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¡£
¥¹¥Þ¥Û¤ÈPC¤Ç¤Ï¥¡¼ÆþÎϤÎÊý¼°¤¬°Û¤Ê¤ë¤¿¤á¡¢°ì³µ¤Ë£±¤Ä¤Î½èÍý¤Ç¤¹¤Ù¤Æ¤ò¥«¥Ð¡¼¤¹¤ë¤³¤È¤¬½ÐÍè¤Ê¤¤¤¿¤á¤Ç¤¹¡£
¤½¤¦¤¤¤Ã¤¿¥±¡¼¥¹¤òÁÛÄꤷ¤Æ¡¢¤³¤¦¤¤¤Ã¤¿¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤Ë°Í¸¤·¤¿·Á¼°¤Î¥³¥ó¥Ñ¥¤¥ëÊýË¡¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡ã»²¹Í¥µ¥¤¥È¡ä
Unity¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
¥×¥é¥Ã¥È¥Õ¥©¡¼¥à°Í¸¥³¥ó¥Ñ¥¤¥ë
https://docs.unity3d.com/ja/2018.4/Manual/Platform...
XR-Hub ÍÍ
¡ÚUnity¡Û¥×¥é¥Ã¥È¥Õ¥©¡¼¥à¤´¤È¤Ë½èÍý¤òÊѹ¹¤¹¤ëÊýË¡
https://xr-hub.com/archives/13648
£´¡¥CameraMoveSwitcher ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¡¢CameraMoveSwitcher ¥¹¥¯¥ê¥×¥È¤ò¥¢¥¿¥Ã¥Á¤·¤ÆÀßÄê¤ò¹Ô¤¦
¡¡¥Ò¥¨¥é¥ë¥¡¼¤Î¶õ¤¤¤Æ¤¤¤ë¾ì½ê¤Ç±¦¥¯¥ê¥Ã¥¯¤ò¤·¤Æ¥á¥Ë¥å¡¼¤ò³«¤¡¢Create Empty ¤òÁªÂò¤·¤Þ¤¹¡£
¿·¤·¤¤¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬ºîÀ®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢Ì¾Á°¤ò CameraModeSwitcher ¤ËÊѹ¹¤·¤Þ¤¹¡£
¡¡Àè¤Û¤ÉºîÀ®¤·¤¿ CameraModeSwitcher ¥¹¥¯¥ê¥×¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥¿¥Ã¥Á¤·¤Æ¤¯¤À¤µ¤¤¡£
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ò³Îǧ¤·¡¢ÊÑ¿ô¤¬£³¤Äɽ¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¥¢¥µ¥¤¥ó¾ðÊó¤òÅÐÏ¿¤·¤Þ¤¹¡£
¡¡EditorCamera ÊÑ¿ô¤Ë¤Ï¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
¡¡ARCamera ÊÑ¿ô¤Ë¤Ï¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë AR Camera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
¡¡Stage ÊÑ¿ô¤Ë¤Ï¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
¤³¤Á¤é¤Ï¥×¥ì¥Õ¥¡¥Ö¤ÎÊý¤Î Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¢¤ê¤Þ¤»¤ó¤Î¤Ç¡¢Ãí°Õ¤·¤Æ¤¯¤À¤µ¤¤¡£
¥Ò¥¨¥é¥ë¥¡¼²èÁü
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡°Ê¾å¤ÇÀßÄê¤Ï´°Î»¤Ç¤¹¡£
¡¡¤¤¤º¤ì¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤â¥¹¥¤¥Ã¥Á¤ÏÆþ¤ì¤¿¾õÂÖ¡¢¤Ä¤Þ¤ê¥¢¥¯¥Æ¥£¥Ö¤Î¾õÂ֤ˤ·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¥¹¥¯¥ê¥×¥È¤ò»ÈÍѤ·¤Æ¡¢ÍøÍѤ·¤Ê¤¤¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎÊý¤Î¥¹¥¤¥Ã¥Á¤òÀÚ¤ë¤è¤¦¤ËÀ©¸æ¤ò¹Ô¤Ã¤Æ¤¤¤ë¤¿¤á¤Ç¤¹¡£
¡¡¤Þ¤º¤Ï¥¨¥Ç¥£¥¿¡¼¤Ç¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¤¯¤À¤µ¤¤¡£
¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë AR Camera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬Èó¥¢¥¯¥Æ¥£¥Ö¤Î¾õÂ֤ˤʤì¤Ð¡¢À©¸æÀ®¸ù¤Ç¤¹¡£
¡¡¼¡¤Ï¡¢¥Ó¥ë¥É¤ò¹Ô¤Ã¤Æ¡¢¼Âµ¡¤Ë¤Æ¥Æ¥¹¥È¤ò¹Ô¤¤¤Þ¤¹¡£
MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬Èó¥¢¥¯¥Æ¥£¥Ö¤Î¾õÂ֤ˤʤꡢ¥«¥á¥é¤Ë¥¹¥Æ¡¼¥¸¤¬É½¼¨¤µ¤ì¤Ê¤¯¤Ê¤ì¤Ð¡¢À©¸æÀ®¸ù¤Ç¤¹¡£
CameraModeSwitcher Æâ¤Î¥³¥á¥ó¥È¥¢¥¦¥È¤òºï½ü¤·¤Æ Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬Èó¥¢¥¯¥Æ¥£¥Ö¤Î¾õÂ֤ˤʤ뤫¤É¤¦¤«¤â³Îǧ¤·¤Æ¤ª¤¯¤È¤¤¤¤¤Ç¤·¤ç¤¦¡£
¥¨¥Ç¥£¥¿¡¼¤Ç¤Î³Îǧ
¡¡¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
¡¡=>¡¡¼¡¤Ï¡¡È¯Å¸£³¡¡¡ÝAR ¥«¥á¥é¤Î¥×¥ì¥¤¥ä¡¼Äɽ¾½èÍý¤Î¼ÂÁõ¡Ý¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯