ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2024ǯ06·î17Æü(·î) 12:51:02ÍúÎò
¡¡£µ¡¥AR Camera ¤Ë¥×¥ì¥¤¥ä¡¼¤òÄÉÈø¤¹¤ëµ¡Ç½¤ò¼ÂÁõ¤¹¤ë
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦AR Camera ¤ÎÀßÄê
¡¡AR ¥·¡¼¥ó¤Ë¤ª¤¤¤Æ¤Î¥²¡¼¥à²èÌ̤ϡ¢AR Camera ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ë¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë Camera ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤¬±Ç¤·¤Æ¤¤¤ë²èÌ̤ˤʤê¤Þ¤¹¡£
¡¡¥²¡¼¥à³«»Ï¤Ë¹ç¤ï¤»¤Æ¥¥ã¥é¤Ï¼ÐÌ̤ò³ê¤ê»Ï¤á¤Þ¤¹¤¬¡¢¥«¥á¥é¤Î°ÌÃÖ¤ÏÊѹ¹¤µ¤ì¤Þ¤»¤ó¡£
¤½¤Î¤¿¤á¡¢¥²¡¼¥à²èÌ̤¬¥¥ã¥é¤Î°ÜÆ°¤Ë¹ç¤ï¤»¤Æ¼«Æ°Åª¤ËÊѹ¹¤µ¤ì¤ë¤³¤È¤Ï¤¢¤ê¤Þ¤»¤ó¡£
¡¡º£²ó¤Ï¡¢¤¹¤Ç¤ËºîÀ®ºÑ¤Î CameraController ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¤Æ¡¢AR Camera ¤¬¥×¥ì¥¤¥ä¡¼¤òÄɽ¾¤¹¤ë¤è¤¦¤ËÀ߷פò½¤Àµ¤·¤Þ¤¹¡£
¡¡Äɽ¾½èÍý¤Î¼ÂÁõÊýË¡¤ÏƱ¤¸¤Ç¤¹¡£
¡¡¥²¡¼¥à¤¬»Ï¤Þ¤ëºÝ¤Î¤ª¸ß¤¤¤Î°ÌÃÖ¤ò¸µ¤Ë¡¢¤É¤Î°Ì¤Îµ÷ΥΥ¤ì¤Æ¤¤¤ë¤«¤òÊäÀµÃͤȤ·¤ÆÍÑ°Õ¤·¤Þ¤¹¡£
¤³¤ì¤Ï¤¤¤ï¤Ð¡¢¥¥ã¥é¤È¥«¥á¥é¤Îº¹Ê¬ÃͤǤ¹¡£¤½¤Î¤¿¤á¡¢¥¥ã¥é¤¬³ê¤ë¤³¤È¤Ë¤è¤Ã¤Æ²¼Êý¸þ¤Ø°ÜÆ°¤¹¤ë¾ì¹ç¡¢¤³¤Îº¹Ê¬ÃÍʬ¤Îµ÷Î¥¤À¤±Î¥¤ì¤ÆÄɽ¾¤¹¤ë¤è¤¦¤Ë¤¹¤ì¤Ð¡¢
¥«¥á¥é¤â°ì½ï¤Ë²¼Êý¸þ¤Ë°ÜÆ°¤·¤Ä¤Ä¡¢¥²¡¼¥à³«»Ï»þ¤«¤é¤Îµ÷Î¥¤òÊݤ俤ޤޥ¥ã¥é¤òÄɽ¾¤¹¤ë¤è¤¦¤ËÀ©¸æ¤ò¹Ô¤¦¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡ã¼ÂÁõÆ°²è¡¡Scene¥Ó¥å¡¼¤â¸«¤ë¤È¡¢¾ï¤Ë°ìÄê¤Îµ÷Î¥¤òÊݤäƥ«¥á¥é¤¬¥¥ã¥é¤òÄɽ¾¤·¤Æ¤¤¤ë¡ä
https://gyazo.com/1ecfc319333bff38ea624cf197334e7c
¡¡
¡¡¤Þ¤º¤ÏºÇ½é¤Ë¡¢¥«¥á¥é¤Î°ÌÃÖ¤òÀßÄꤷ¤Þ¤¹¡£¤³¤Î°ÌÃ֤ȥ¥ã¥é¤Î°ÌÃ֤Ȥ¬ÊäÀµÃͤȤʤê¤Þ¤¹¤Î¤Ç½ÅÍפʾðÊó¤Ç¤¹¡£
¡¡¥«¥á¥éÍѤΥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃÖ¤òÄ´À°¤·¤Æ¡¢Penguin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò±Ç¤¹°ÌÃ֤˰ÜÆ°¤µ¤»¤Þ¤¹¡£
AR Foundation 4.x ¤È 5.x ¤Ë¤è¤ê¡¢ÂоݤȤʤ륲¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬°Û¤Ê¤ê¤Þ¤¹¡£
¡¡AR Foundation 4.x ¤Î¾ì¹ç¡¢AR Camera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ï AR¡¡Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢
º£²ó¤Ï AR Camera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃ֤ǤϤʤ¯¡¢AR¡¡Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃÖ¤òÄ´À°¤·¤Æ¥«¥á¥é¤Î°ÌÃ֤Ȥ·¤ÆÀßÄꤷ¤Þ¤¹¡£
¡¡¤Ê¤ª¡¢AR Foundation 5.x °Ê¹ß¤Ç¤Ï¡¢AR Camera ¤Ï XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢
XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃÖ¤òÄ´À°¤·¤Æ¥«¥á¥é¤Î°ÌÃ֤Ȥ·¤ÆÀßÄꤷ¤Þ¤¹¡£
¡¡Scene¥Ó¥å¡¼¤Ç¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃÖ¤òÁàºî¤·¤Ê¤¬¤é¡¢Game ¥Ó¥å¡¼¡¢¤¢¤ë¤¤¤Ï Scene ¥Ó¥å¡¼¤Ëɽ¼¨¤µ¤ì¤ë Camera ¥Ó¥å¡¼¤ò¸«¤Ê¤¬¤éÁàºî¤ò¹Ô¤¤¤Þ¤¹¡£
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü¤Î Position ¤ä Rotation ¤Î°ÌÃÖ¤ò»²¹Í¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡²óž³ÑÅÙ¤Ï X ¼´¤À¤± 15 Á°¸å¤Ë¤¹¤ë¤È¡¢¼ÐÌ̤Υ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÈƱ¤¸³ÑÅÙ¤¬¤Ä¤¤¤Æ¸«¤ä¤¹¤¯¤Ê¤ê¤Þ¤¹¡£
AR Foundation 4.x AR¡¡Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
AR Foundation 5.x XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
Scene¥Ó¥å¡¼¡
Scene¥Ó¥å¡¼¢
Scene¥Ó¥å¡¼£
Game¥Ó¥å¡¼
¡¡AR Camera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¥¢¥¿¥Ã¥Á¤·¤Æ¤âÍøÍѤǤ¤ë¤è¤¦¤Ë½¤Àµ¤ò¹Ô¤¤¤Þ¤¹¡£
¹ç¤ï¤»¤Æ¡¢º£¸å¡¢AR ¥·¡¼¥ó¤Ë¤ª¤¤¤Æ¥¹¥Æ¡¼¥¸¤ò¸å¤«¤éÀ¸À®¤¹¤ë½èÍý¤ËÊѹ¹¤·¤Æ¤âÂбþ¤Ç¤¤ë¤è¤¦¤Ë¡¢½èÍý¤ò¥á¥½¥Ã¥É²½¤·¤¿¤ê¡¢¿·¤·¤¤¥á¥½¥Ã¥É¤òÄɲ䷤Ƥ¤¤Þ¤¹¡£
¡¡Start ¥á¥½¥Ã¥ÉÆâ¤È Update ¥á¥½¥Ã¥ÉÆâ¤â½¤Àµ¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢½èÍý¤ÎÆâÍƤòÍý²ò¤·¤Ê¤¬¤é½¤Àµ¤ò¹Ô¤Ã¤Æ¤¯¤À¤µ¤¤¡£
¤¿¤À½ñ¤¼Ì¤·¤Æ¤¤¤ë¤À¤±¤Ç¤Ï³Ø½¬¤Ë¤Ê¤ê¤Þ¤»¤ó¡£¾ï¤Ë¹Í¤¨¤ë¤è¤¦¤Ë¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
CameraController.cs
£´¡¥AR Session Origin(XR Origin) ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë Camera Controller ¥¹¥¯¥ê¥×¥È¤ò¥¢¥¿¥Ã¥Á¤·¡¢ÀßÄê¤ò¹Ô¤¦
¡¡AR Foundation ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤ê¡¢¥¹¥¯¥ê¥×¥È¤Î¥¢¥¿¥Ã¥ÁÀ褬°Û¤Ê¤ê¤Þ¤¹¡£
¡¡AR Foundation 4.x ¤Î¾ì¹ç¡¢Scripts ¥Õ¥©¥ë¥À¤Ë¤¢¤ë Camera Controller ¥¹¥¯¥ê¥×¥È¤ò¥É¥é¥Ã¥°¤·¤Æ¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë AR Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¾å¤Ç¥É¥í¥Ã¥×¤·¤Þ¤¹¡£
AR Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ç³Îǧ¤·¤Æ¡¢¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¤â¤·¤â¥¢¥¿¥Ã¥Á½ÐÍè¤Æ¤¤¤Ê¤±¤ì¤Ð¤â¤¦°ìÅÙ¡¢¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥¿¥Ã¥Á¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡AR Foundation 5.x ¤Î¾ì¹ç¡¢Scripts ¥Õ¥©¥ë¥À¤Ë¤¢¤ë Camera Controller ¥¹¥¯¥ê¥×¥È¤ò¥É¥é¥Ã¥°¤·¤Æ¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¾å¤Ç¥É¥í¥Ã¥×¤·¤Þ¤¹¡£
XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ç³Îǧ¤·¤Æ¡¢¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¤â¤·¤â¥¢¥¿¥Ã¥Á½ÐÍè¤Æ¤¤¤Ê¤±¤ì¤Ð¤â¤¦°ìÅÙ¡¢¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥¿¥Ã¥Á¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ë¥¢¥µ¥¤¥ó¾ðÊó¤¬É½¼¨¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢½çÈ֤˥¢¥µ¥¤¥ó¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡PlayerObjs ÊÑ¿ô¤Ë¤Ï¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤Ë¤¢¤ë penguin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
¡¡CameraPos ÊÑ¿ô¤Ë¤Ï¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë AR Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¢
¤¢¤ë¤¤¤Ï XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¤¤¤º¤ì¤«¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
AR Session Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
XR Origin ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡°Ê¾å¤ÇÀßÄê¤Ï´°Î»¤Ç¤¹¡£
¡¡CameraController ¥¹¥¯¥ê¥×¥È¤ËÊÑ¿ô¤òÄɲ䷤Ƥ¤¤ë¤Î¤Ç¡¢Æ±¤¸¤¯ CameraController ¥¹¥¯¥ê¥×¥È¤¬¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ë
MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Ë¤âÊÑ¿ô¤¬Äɲ䵤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¤½¤Á¤é¤Ë¥¢¥µ¥¤¥ó¤ò¹Ô¤¤¤Þ¤¹¡£
¡¡CameraPos ÊÑ¿ô¤Ë¤Ï¡¢¥Ò¥¨¥é¥ë¥¡¼¤Ë¤¢¤ë Stage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥ÈÆâ¤Î MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Þ¤¹¡£
MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡°Ê¾å¤ÇÀßÄê¤Ï´°Î»¤Ç¤¹¡£
¡¡¥¨¥Ç¥£¥¿¡¼¤Ë¤Æ¥²¡¼¥à¤ò¼Â¹Ô¤·¡¢¤¤¤Þ¤Þ¤Ç¤ÈƱ¤¸¤è¤¦¤Ë MainCamera ¤¬¥×¥ì¥¤¥ä¡¼¤òÄɽ¾¤·¤Æ¤¤¤ë¤³¤È¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡ÌäÂ꤬¤Ê¤±¤ì¤Ð¡¢¥Ó¥ë¥É¤ò¹Ô¤¤¡¢¼Âµ¡¤Ë¤Æ¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¡¢AR ¤Ë¤ª¤¤¤Æ¡¢AR ¥«¥á¥é¤¬¥×¥ì¥¤¥ä¡¼¤òÄɽ¾¤¹¤ë¤è¤¦¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤«¤ò³Îǧ¤·¤Þ¤¹¡£
¤â¤·¤â AR Camera ¤¬Äɽ¾¤·¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢CameraController ¥¹¥¯¥ê¥×¥È¤ò¸«Ä¾¤¹¤«¡¢¥¢¥µ¥¤¥ó¾ðÊó¤ò´Ö°ã¤¨¤Æ¤¤¤Ê¤¤¤«¤ò³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
¡¡=>¡¡¼¡¤Ï¡¡È¯Å¸£´¡¡¡Ý¥¹¥Þ¥Û¤Ç¤Î¥×¥ì¥¤¥ä¡¼¤ÎÀ©¸æµ¡Ç½¤Î¼ÂÁõ¡Ý¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯