ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2023ǯ10·î09Æü(·î) 15:49:55ÍúÎò
¥²¡¼¥à²èÌ̤˾ï»þ¡¢¥ï¡¼¥ë¥É¥Þ¥Ã¥×¤ä¥¨¥ê¥¢¥Þ¥Ã¥×¤Ê¤É¤ò½Ì¾®É½¼¨¤·¤Þ¤¹¡£
¡ã´°À®»þ¤Î Game ¥Ó¥å¡¼²èÁü¡¡¡¥¨¥ê¥¢¥Þ¥Ã¥×¡ä
¡ã´°À®»þ¤Î Game ¥Ó¥å¡¼²èÁü¢¡¡¥ï¡¼¥ë¥É¥Þ¥Ã¥×¡ä
¡ã¿·¤·¤¯³Ø½¬¤¹¤ëÆâÍÆ¡ä
¡¡¡¦RenderTexture ¡¡¡¦Mask ¥³¥ó¥Ý¡¼¥Í¥ó¥È ¡¡¡¦RawImage ¥³¥ó¥Ý¡¼¥Í¥ó¥È
¡¡¥ß¥Ë¥Þ¥Ã¥×¤ò²èÌÌÆâ¤Î¼ÙËâ¤Ë¤Ê¤é¤Ê¤¤°ÌÃÖ¤Ëɽ¼¨¤·¡¢¥²¡¼¥à²èÌ̤ò¾å¶õ¤«¤éÐíâפ·¤Æ¸«¤¨¤ë¤è¤¦¤Ë¤¹¤ëµ¡Ç½¤ò¼ÂÁõ¤·¤Þ¤¹¡£
¡¡
¡¡º£²ó¤Î¼ê½ç¤Ç¤ÏɬÍפʥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎºîÀ®¤ò¹Ô¤¤¡¢¼¡¤Î¼ê½ç¤Ç¥¹¥¯¥ê¥×¥È¤òºîÀ®¤·¤Æ¡¢¥ß¥Ë¥Þ¥Ã¥×¤ÎÀ©¸æ¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡¤³¤Á¤é¤Î¥µ¥¤¥È¤ò»²¹Í¤Ë¤·¤Æ¤ª¤ê¤Þ¤¹¡£(¤³¤Á¤é¤Ç¤Ï£³£ÄÍѤΥߥ˥ޥåפÎÀ©ºî¼ê½ç¤¬¾Ò²ð¤µ¤ì¤Æ¤¤¤Þ¤¹)
¡ÚUnity¡Û¥ß¥Ë¥Þ¥Ã¥×¤Îºî¤êÊý¡ªÅ¨¤ä¥¢¥¤¥Æ¥à¤Î°ÌÃÖ¤¬°ìÌܤÇʬ¤«¤ë¤è¤¦¤Ë¤·¤è¤¦
¡¡¥«¥á¥é¤Ë±Ç¤ë¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¼ïÎà¤ò Layer ¤Ë¤è¤Ã¤ÆÀ©¸æ¤Ç¤¤ë¤è¤¦¤Ë¡¢¿·¤·¤¤ Layer ¤òºîÀ®¤·¤Þ¤¹¡£
¡¡Ground ¤È GroundDetector ¤Î£²¤Ä¤Î Layer ¤òºîÀ®¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡ÃÏÌÌÍѤΥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È(¤¢¤ë¤¤¤Ï¥¿¥¤¥ë¥Þ¥Ã¥×)¤Î Layer¤Ë¤Ï Ground ¤òÀßÄꤷ¡¢
¾¤Ë¥ß¥Ë¥Þ¥Ã¥×¤Ëɽ¼¨¤·¤¿¤¤¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È(¥×¥ì¥¤¥ä¡¼¤äŨ¤Î°ÌÃÖÍѤΥޡ¼¥«¡¼¤Ê¤É)¤Î Layer ¤Ë¤Ï GroundDetector ¤òÀßÄꤷ¤Þ¤¹¡£
¡¡¤Þ¤º¤ÏÃÏÌÌÍÑ¡¢¥¿¥¤¥ë¥Þ¥Ã¥×¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î Layer ¤Ë Ground ¤òÀßÄꤷ¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¥ß¥Ë¥Þ¥Ã¥×¤Ë±Ç¤·¤¿¤¤¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤À¤±ÀßÄꤹ¤ì¤ÐÌäÂꤢ¤ê¤Þ¤»¤ó¡£
Tags And Layers¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼²èÁü
¡¡RenderTexture ¤Ï¡¢¥ê¥¢¥ë¥¿¥¤¥à¤ËÉÁ²è¤ò¹Ô¤¦¥¿¥¤¥×¤Î¥Æ¥¯¥¹¥Á¥ã¤Ç¤¹¡£
º£²ó¤Î¾ì¹ç¤Ç¤¢¤ì¤Ð¡¢¥«¥á¥é¤Î²èÁü¤ò¥ê¥¢¥ë¥¿¥¤¥à¤ËÅê±Æ¤µ¤»¤ë¥Æ¥¯¥¹¥Á¥ã¤È¤·¤ÆÍøÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¡Ç¤°Õ¤Î¥Õ¥©¥ë¥ÀÆâ¤Ç Create => RenderTexture ¤òÁªÂò¤¹¤ë¤³¤È¤Ç¿·¤·¤¤ RenderTexture ¤òºîÀ®¤Ç¤¤Þ¤¹¡£
̾Á°¤Ï MinimapRenderTexture ¤Î¤è¤¦¤Ë¡¢¤ï¤«¤ê¤ä¤¹¤¤Ì¾¾Î¤Ë¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡ÆäËÀßÄê¤òÊѹ¹¤¹¤ëɬÍפϤ¢¤ê¤Þ¤»¤ó¡£
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤ÇÀßÄê²Äǽ¤Ê¹àÌܤξܺ٤ˤĤ¤¤Æ¤Ï¡¢Unity ¤Î¥Þ¥Ë¥å¥¢¥ë¤Ê¤É¤ò»²¹Í¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥Þ¥Ë¥å¥¢¥ë
¥ì¥ó¥À¡¼¥Æ¥¯¥¹¥Á¥ã
¤Ï¤Ê¤Á¤ë¤Î¥Þ¥¤¥Î¡¼¥È ÍÍ
¡ÚUnity¡Û3ʬ¤Çʬ¤«¤ëRenderTexture¤ò»È¤Ã¤ÆRawImage¤Ë¥«¥á¥é¤Î±ÇÁü¤ò¼Ì¤¹¼ê½ç
¡¡¥ß¥Ë¥Þ¥Ã¥×ÍѤΥ«¥á¥é¤ò¿·¤·¤¯ºîÀ®¤·¤Þ¤¹¡£
¡¡¥Ò¥¨¥é¥ë¥¡¼¤Î¶õ¤¤¤Æ¤¤¤ë¾ì½ê¤Ç±¦¥¯¥ê¥Ã¥¯¤ò¤·¤Æ¥á¥Ë¥å¡¼¤ò³«¤¡¢Camera ¤òÁªÂò¤·¤Þ¤¹¡£
¿·¤·¤¤ Camera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬ºîÀ®¤µ¤ì¤Þ¤¹¤Î¤Ç¡¢Ì¾Á°¤ò MinimapCamera ¤ËÊѹ¹¤·¤Þ¤¹¡£
¡¡Transform ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î Position ¤Î X ¼´¤È Y ¼´¤Ë¤Ä¤¤¤ÆŬµ¹¤Ê°ÌÃÖ¤ËÄ´À°¤·¤Æ¤¯¤À¤µ¤¤¡£
¥×¥ì¥¤¥ä¡¼¤¬±Ç¤ë°ÌÃ֤˰ÜÆ°¤µ¤»¤Æ¤ª¤¯¤È¤è¤¤¤Ç¤·¤ç¤¦¡£
Z ¼´¤Ë¤Ä¤¤¤Æ¤Ï -10 ¤Ë¤·¤Æ¡¢¥²¡¼¥à²èÌ̤ò°ú¤¤¤Æ±Ç¤¹°ÌÃÖ¤ËÇÛÃÖ¤·¤Æ¤¯¤À¤µ¤¤¡£(¤½¤¦¤·¤Ê¤¤¤È¥²¡¼¥à²èÌ̤¬¥«¥á¥é¤Ë±Ç¤ê¤Þ¤»¤ó)
¡¡¤Þ¤¿¡¢AudioListener ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï¤¤¤º¤ì¤«¤Î¥«¥á¥é¤Ë£±¤Ä¥¢¥¿¥Ã¥Á¤µ¤ì¤Æ¤¤¤ì¤ÐÉÔÍפǤ¢¤ë¤¿¤á¡¢¤³¤Î¥«¥á¥é¤«¤é¤Ï¥ê¥à¡¼¥Ö¤·¤Þ¤¹¡£
¡¡Camera ¥³¥ó¥Ý¡¼¥Í¥ó¥ÈÆâ¤Î³Æ¹àÌܤÎÀßÄê¤ò½çÈ֤˹Ԥ¤¤Þ¤¹¡£
¡¡Clear Flags ¤ÎÀßÄê¤ò Solid Color ¤ËÊѹ¹¤·¤Þ¤¹¡£
Background ¤Î¹àÌܤ¬Äɲ䵤ì¤Æ¡¢ÇØ·Ê¿§¤òÁªÂò¤Ç¤¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¤¬¡¢½é´üÀßÄê¤Îº°¤ä¹õ¤Î¤Þ¤Þ¤ÇÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡¡Culling Mask ¤ÎÀßÄê¤ò¹Ô¤¤¡¢Ground ¤È GroundDetector ¤Î£²¤Ä¤Î Layer ¤Î¤ß¤òÁªÂò¤·¤Þ¤¹¡£
¤³¤¦¤¹¤ë¤³¤È¤Ë¤è¤ê¡¢»ØÄꤷ¤¿ Layer ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È·²¤Î¤ß¤òÉÁ²è¤¹¤ë¥«¥á¥é¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡Projection Type ¤ÎÀßÄê¤ò Orthographic ¤ËÀßÄꤷ¤Þ¤¹¡£(ºÇ½é¤«¤éÀßÄꤵ¤ì¤Æ¤¤¤ì¤ÐÊѹ¹¤ÏÉÔÍפǤ¹)
²èÌ̤òÊ¿¹ÔÅê¼Í¤·¤ÆÉÁ²è¤¹¤ë¥«¥á¥é¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡Size ¤ÎÃͤϥߥ˥ޥåפÎɽ¼¨·Á¼°¤ò¡Ö¥²¡¼¥àÁ´ÂΤΥ¥ë¥É¥Þ¥Ã¥×¤Î½Ì¾®¥µ¥¤¥º¡×¤Ë¤¹¤ë¤«¡¢¡Ö¥×¥ì¥¤¥ä¡¼¼þÊդΥ¨¥ê¥¢¥Þ¥Ã¥×¤Î½Ì¾®¥µ¥¤¥º¡×¤Ë¤¹¤ë¤«¤Ë¤è¤Ã¤Æ¡¢ÃͤòÀßÄꤷ¤Þ¤¹¡£
¤³¤ÎÃͤˤè¤Ã¤Æ¡¢¥«¥á¥é¤ÎÉÁ²èÈϰϤ¬ÊѲ½¤·¤Þ¤¹¤Î¤Ç¡¢Ä´À°¤·¤Ê¤¬¤éÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
´ðËÜŪ¤Ë¤Ï¡¢¥ï¡¼¥ë¥É¥Þ¥Ã¥×¤Ë¤¹¤ë¾ì¹ç¤Ë¤ÏÃͤòÂ礤¯¡¢¥¨¥ê¥¢¥Þ¥Ã¥×¤Ë¤¹¤ë¾ì¹ç¤Ë¤ÏÃͤò¾®¤µ¤¯ÀßÄꤷ¤Þ¤¹¡£
¡¡Clipping Planes ¤ÎÀßÄê¤Î¤¦¤Á¡¢Far ¤ÎÃͤò 30 Á°¸å¤Ë²¼¤²¤Þ¤¹¡£¤³¤ì¤Ï¥«¥á¥é¤¬±Ç¤¹µ÷Î¥¤ÎºÇÂçÃͤǤ¹¡£
±ó¤¯¤Þ¤ÇÉÁ²è¤ò¹Ô¤¦É¬Íפ¬¤Ê¤¤¤¿¤á¡¢¿ôÃͤò²¼¤²¤ÆɬÍפÊÈϰϤÀ¤±¤òÉÁ²è¤¹¤ë¤è¤¦¤Ë¤·¡¢¥«¥á¥é¤Ë¤è¤ëÉÁ²èÉé²Ù¤ò²¼¤²¤Þ¤¹¡£
¡¡Target Texture ¤ÎÉôʬ¤Ë¡¢Àè¤Û¤ÉºîÀ®¤·¤¿ MinimapRenderTexture ¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£
¤³¤ì¤Ç¡¢MinimapCamera ¤¬ÉÁ²è¤·¤¿ÆâÍƤ¬¡¢MinimapRenderTexture ¤Ë¤âÉÁ²è¤µ¤»¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡¤½¤ì°Ê³°¤ÎÉôʬ¤Ï½é´üÀßÄê¤Î¤Þ¤Þ¤ÇÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡¡Unity ¤Î¥Ð¡¼¥¸¥ç¥ó¤Ë¤è¤ê¡¢Culling Mask ¤Îɽ¼¨·Á¼°¤¬°Û¤Ê¤ê¤Þ¤¹¤¬¡¢ÀßÄêÆâÍƤÏƱ¤¸¤Ç¤¹¡£
¡ÊPosition ¤Î°ÌÃ֤ϻ²¹Í¤Ë¤Ê¤ê¤Þ¤»¤ó¤Î¤Ç¡¢¼«Ê¬¤Î¥×¥í¥¸¥§¥¯¥È¤Ë¹ç¤ï¤»¤Æ¤¯¤À¤µ¤¤¡£¡Ë
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¡¡¡¡¼Culling Mask ¤¬ Mixed ¤È¤Ê¤ë¾ì¹ç¡¼
¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¢¡¡¡¼Culling Mask ¤¬ÀßÄꤷ¤¿ÆâÍƤȤʤë¾ì¹ç¡¼
Culling Mask ¤ÎÆâÍÆ
»²¹Í¥µ¥¤¥È
XR-HU3 ÍÍ
¡ÚUnity¡Û¥«¥á¥é¤Î´ðËÜÀßÄê¤òÍý²ò¤·¤è¤¦¡ª¡ÃCameraÆþÌç¡
https://xr-hub.com/archives/5914
¡¡¥¢¥»¥Ã¥È¥¹¥È¥¢¤«¤é̵ÎÁ¥¢¥»¥Ã¥È¡¢¤¢¤ë¤¤¤Ï̵ÎÁ¤Î¥¤¥é¥¹¥È¥µ¥¤¥È¤«¤é¡¢¥ß¥Ë¥Þ¥Ã¥×ÍѤΥե졼¥à²èÁü¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤Æ Unity ¤Ø¥¤¥ó¥Ý¡¼¥È¤·¤Æ¤ª¤¤Þ¤¹¡£
ÀìÍѤΥե©¥ë¥À¤òºîÀ®¤·¤Æ¤ª¤¯¤È´ÉÍý¤·¤ä¤¹¤¤¤Ç¤¹¡£
¡¡
¡¡²¼µ¤Ï̵ÎÁ¥¢¥»¥Ã¥È¤Ç¤¹¡£
Fantasy Wooden GUI : Free
https://assetstore.unity.com/packages/2d/gui/fanta...
Dark Brown GUI kit
https://assetstore.unity.com/packages/2d/gui/dark-...
¡¡¥¤¥ó¥Ý¡¼¥È¤·¤¿²èÁü¤Î Texture Type ¤ò Default ¤«¤é Sprite(2D and UI) ¤ËÊѹ¹¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡¥Þ¥¹¥¯ÍѤβèÁü¤Ë¤Ä¤¤¤Æ¤Ï¡¢Unity ¤Ë¥¤¥ó¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë UI ²èÁü¤Ç¤âÂбþ¤Ç¤¤Þ¤¹¡£
¤Þ¤¿¡¢²¼µ¤Î¥µ¥¤¥ÈÆâ¤ÇÇÛÉÛ¤µ¤ì¤Æ¤¤¤ë´Ý·¿¤Î¥Þ¥¹¥¯²èÁü¤ò¥À¥¦¥ó¥í¡¼¥É¤·¤ÆÍøÍѤ·¤Æ¤¤¤¿¤À¤¤¤Æ¤âÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡ÚUnity¡Û¥ß¥Ë¥Þ¥Ã¥×¤Îºî¤êÊý¡ªÅ¨¤ä¥¢¥¤¥Æ¥à¤Î°ÌÃÖ¤¬°ìÌܤÇʬ¤«¤ë¤è¤¦¤Ë¤·¤è¤¦
¡¡¿·¤·¤¤ Canvas ¤òºîÀ®¤·¤Þ¤¹¡£
̾Á°¤ò CanvasWithMinimap ¤ËÊѹ¹¤·¤Þ¤¹¡£
¡¡¤³¤³¤Ç¤Ï Canvas ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î Render Mode ¤ÎÀßÄ꤬ Screen Space - Overlay ¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤¬¡¢
Ä̾ï¤Î UI ¤Î¤è¤¦¤Ë¡¢¾ï¤ËÁ°Ì̤˥ߥ˥ޥåפòɽ¼¨¤µ¤»¤ëÀßÄê¤Ç¤¹¤¬¡¢World Space ¤ËÊѹ¹¤·¤Æ¡¢¥²¡¼¥à¶õ´Ö¤ËÇÛÃÖ¤·¤Æ¤â¹½¤¤¤Þ¤»¤ó¡£
¡¡Canvas Scaler ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î UI Scale Mode ¤Ê¤É¤ÎÀßÄê¤ò¹Ô¤¤¡¢¥²¡¼¥à²èÌ̤ÈƱ¤¸¥µ¥¤¥º¤ËÊѹ¹¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤Þ¤¿¤³¤Î Canvas ¤Ç¤Ï GraphicRaycaster ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ÏÉÔÍפǤ¹¤Î¤Ç¡¢¥ê¥à¡¼¥Ö¤·¤Æ¤¯¤À¤µ¤¤(»Ä¤Ã¤Æ¤¤¤Æ¤âÌäÂê¤Ï¤¢¤ê¤Þ¤»¤ó)¡£
¡¡CanvasWithMinimap ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¡¢¿·¤·¤¤ Image ¤òºîÀ®¤·¤Þ¤¹¡£
̾¾Î¤ÏǤ°Õ¤ËÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
¡¡¥¢¥ó¥«¡¼¤òÀßÄꤷ¤¿¾å¤Ç¡¢Ç¤°Õ¤Î°ÌÃÖ¤ËÇÛÃÖ¤·¤Æ¤¯¤À¤µ¤¤¡£
¤³¤³¤Ç¤Ïº¸¾å¤òÀßÄꤷ¤Æ¤¤¤Þ¤¹¤¬¡¢Â¾¤Î°ÌÃ֤ǤâÌäÂꤢ¤ê¤Þ¤»¤ó¡£
¡¡¤³¤Á¤é¤Ï¡¢¥ß¥Ë¥Þ¥Ã¥×¤òɽ¼¨¤µ¤»¤ë¥Õ¥ì¡¼¥àÍѤβèÁü¤òÀßÄꤷ¤Þ¤¹¡£
Image ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î Source Image ¤Ë¡¢Àè¤Û¤É¥¤¥ó¥Ý¡¼¥È¤·¤¿²èÁü¤ÎÆâ¤Î¡¢¥Õ¥ì¡¼¥àÍѤβèÁü¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤Þ¤¿ Image ¥³¥ó¥Ý¡¼¥Í¥ó¥ÈÆâ¤Î Raycast Target ¤Î¥Á¥§¥Ã¥¯¤ò³°¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤³¤Á¤é¤ÏÀè¤Û¤É¤Î¥Þ¥Ã¥×¤Î¥Õ¥ì¡¼¥à¤Î·Á¾õ¤Ë¹ç¤ï¤»¤Æ¡¢É¬Íפ˱þ¤¸¤ÆÄɲ䷤Ƥ¯¤À¤µ¤¤¡£
¥Õ¥ì¡¼¥à¤Î·Á¾õ¤ò¤½¤Î¤Þ¤ÞÍøÍѤ¹¤ë¾ì¹ç¤Ë¤ÏÉÔÍפǤ¹¡£
¡¡Î㤨¤Ð¡¢¥Õ¥ì¡¼¥àÍѤβèÁü¤¬´Ý¤¤·Á¾õ¤ò¤·¤Æ¤¤¤ë¾ì¹ç¡¢·Á¾õÆâ¤Î¤ßÉÁ²è¤ò¹Ô¤¤¡¢³°Â¦¤òɽ¼¨¤·¤Ê¤¤¤è¤¦¤Ë¤¹¤ë¤¿¤á¤Î¡¢
¥Þ¥¹¥¯¤ÎÀßÄê¤ò¹Ô¤¦¤¿¤á¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ç¤¹¡£
¡¡µ¡Ç½Åª¤Ë¤Ï RectMask2D ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¥¢¥¿¥Ã¥Á¤¹¤ë¤³¤È¤Ç¼Â¸½¤Ç¤¤Þ¤¹¡£
¥Á¥ã¥ì¥ó¥¸¤·¤Æ¤ß¤Þ¤·¤ç¤¦¡£
¡ã¼ÂÁõÆ°²è¡ä
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡Image ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¡¢¤â¤¦£±¤Ä Image ¤òºîÀ®¤·¤Þ¤¹¡£
¤³¤Á¤é¤Î̾¾Î¤Ï Mask ¤ËÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¥¤¥ó¥¹¥Ú¥¯¥¿¡¼¤Î°ìÈÖ²¼¤Ë¤¢¤ë Add Component ¥Ü¥¿¥ó¤ò²¡²¼¤·¤Æ¡¢Mask ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÄɲ䷤Ƥ¯¤À¤µ¤¤¡£
Show Mask Graphic ¤Ë¥Á¥§¥Ã¥¯¤¬Æþ¤Ã¤Æ¤¤¤ë¾ì¹ç¤Ë¤Ï¡¢¥Á¥§¥Ã¥¯¤ò³°¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡
¡¡Image ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î Source Image ¤Ë¤Ï¥Þ¥¹¥¯ÍѤβèÁü¤òÀßÄꤷ¤Þ¤¹¡£
Àè¤Û¤É¥¤¥ó¥Ý¡¼¥È¤·¤¿²èÁü¤ÎÆâ¤Î¡¢¥Þ¥¹¥¯ÍѤβèÁü¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥Þ¥Ë¥å¥¢¥ë
Mask
https://docs.unity3d.com/ja/current/Manual/script-...
[Kan ¤Î¥á¥âÄ¢] ÍÍ
Sprite¤äImage¤ÇMask¤ò»È¤Ã¤Æ²èÁü¤òǤ°Õ¤Î·Á¤ËÀÚ¤êÈ´¤¤¤Æɽ¼¨¤¹¤ë ¡ÚUnity¡Û¡ÚuGUI¡Û
https://kan-kikuchi.hatenablog.com/entry/Mask
½Âë¤Û¤È¤È¤®¤¹ÄÌ¿® ÍÍ
¡ÚUI¥Ç¥¶¥¤¥Ê¡¼¸þ¤±¡ÛUnity UI(uGUI)¤Ç¥½¥Õ¥È¥Þ¥¹¥¯¤Îºî¤êÊý¢¨¥×¥í¥°¥é¥ß¥ó¥°ÉÔÍ×
https://shibuya24.info/entry/ugui_rect2dmask
¡¡Texture ¤Î²èÁü¤òɽ¼¨¤µ¤»¤ë¤¿¤á¤Î¥³¥ó¥Ý¡¼¥Í¥ó¥È¤È¤·¤Æ RawImage ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤¬ÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
Ä̾ï¤Î Iamge ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï Sprite ·Á¼°¤Î²èÁü¤Î¤ß¤ò UI ¤È¤·¤ÆÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤Þ¤¹¤¬¡¢
RawImage ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ç¤Ï¡¢UI ɽ¼¨¤µ¤»¤ë¤¿¤á¤Ë¡¢Sprite ·Á¼°°Ê³°¤Î²èÁü¤âÀßÄꤹ¤ë¤³¤È¤¬²Äǽ¤Ç¤¹¡£
¤½¤Î¤¿¤á¡¢RenderTexture ¤âÀßÄꤹ¤ë¤³¤È¤¬½ÐÍè¤Þ¤¹¡£
¡¡¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎºîÀ®°ÌÃ֤ϡ¢Mask ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎÍ̵¤Ç°Û¤Ê¤ê¤Þ¤¹¡£
¼ê½ç¤Ë¤«¤«¤ï¤é¤º¡¢Ì¾Á°¤Ï RawImage_Minimap ¤ËÊѹ¹¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡Mask ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¤Ê¤¤¾ì¹ç¤Ë¤Ï¡¢Image ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¡¢UI => RawImage ¤òÁªÂò¤·¤Æ¡¢¿·¤·¤¯ RawImage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Þ¤¹¡£
¡¡Mask ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤¬¤¢¤ë¾ì¹ç¤Ë¤Ï¡¢Mask ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¡¢UI => RawImage ¤òÁªÂò¤·¤Æ¡¢¿·¤·¤¯ RawImage ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Þ¤¹¡£
¡¡Â³¤¤¤Æ¡¢RawImage ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Î Texture ¤ÎÉôʬ¤Ë¡¢MinimapRenderTexture ¤ò¥É¥é¥Ã¥°¥¢¥ó¥É¥É¥í¥Ã¥×¤·¤Æ¥¢¥µ¥¤¥ó¤·¤Æ¤¯¤À¤µ¤¤¡£
¤³¤ì¤Ë¤è¤ê¡¢MinimapRenderTexture ¤Ëɽ¼¨¤µ¤ì¤Æ¤¤¤ë¥«¥á¥é¤¬±Ç¤·¤Æ¤¤¤ë²èÌ̤ÎÆâÍƤò¡¢RawImage ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤¬ UI ¤È¤·¤Æɽ¼¨¤¹¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥Þ¥Ë¥å¥¢¥ë
Raw Image
¡¡¤³¤³¤Þ¤Ç¤Î¼ê½ç¤Ë¤è¤ê¡¢¥ß¥Ë¥Þ¥Ã¥×¼«ÂΤϴ°À®¤È¤Ê¤ê¤Þ¤¹¡£
¥²¡¼¥à¤ò¼Â¹Ô¤·¡¢UI ¤È¤·¤Æ¥ß¥Ë¥Þ¥Ã¥×¤¬É½¼¨¤µ¤ì¤Æ¤¤¤ë¤«³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¤³¤Î¸å¤Î¼ê½ç¤Ï¡¢¥ß¥Ë¥Þ¥Ã¥×¾å¤Ë¥×¥ì¥¤¥ä¡¼¤äŨ¤Ê¤É¤Î¾ðÊó¤ò¥Þ¡¼¥«¡¼¤È¤·¤Æɽ¼¨¤µ¤»¤ë¾ì¹ç¤ÎÀßÄê¤ä
¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¤Ë¹ç¤ï¤»¤Æ¥ß¥Ë¥Þ¥Ã¥×¤òϢư¤µ¤»¤ëÀßÄê¤Ç¤¹¡£
¡¡¼«Ê¬¤ÎÍøÍѤ·¤¿¤¤¥ß¥Ë¥Þ¥Ã¥×¤Î¥¿¥¤¥×¤Ë±þ¤¸¤ÆɬÍפÊÀßÄê¤òÄɲ䷤Ƥ¯¤À¤µ¤¤¡£
¡¡¥ï¡¼¥ë¥É¥Þ¥Ã¥×¤È¤·¤Æ¥ß¥Ë¥Þ¥Ã¥×¤òÍøÍѤ¹¤ë¾ì¹ç¤Ë¤Ï¡¢¤³¤Î¼ê½ç¤ÏÉÔÍפǤ¹¡£
¡¡¥¨¥ê¥¢¥Þ¥Ã¥×¤È¤·¤ÆÍøÍѤ¹¤ë¾ì¹ç¡¢¥×¥ì¥¤¥ä¡¼¤ò¥ß¥Ë¥Þ¥Ã¥×¤ÎÃæ¿´¤ËÃÖ¤¡¢¼þÊÕ¾ðÊó¤ò¹¹¿·¤·¤Æɽ¼¨¤µ¤»¤ë¤³¤È¤Ë¤Ê¤ê¤Þ¤¹¤Î¤Ç
MinimapCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î°ÌÃ֤ȥץ쥤¥ä¡¼¤Î°ÌÃ֤ȤòϢư¤µ¤»¤ëɬÍפ¬¤¢¤ê¤Þ¤¹¡£
¡¡MinimapCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¥×¥ì¥¤¥ä¡¼¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤ËÀßÄꤷ¤Þ¤¹¡£
¥×¥ì¥¤¥ä¡¼¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¹½Â¤¤Ë¹ç¤ï¤»¤Æ¡¢»Ò¥ª¥Ö¥¸¥§¥¯¥È¤ÎÇÛÃÖ¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡ÀßÄꤷ¤¿¤é¡¢¥²¡¼¥à¤ò¼Â¹Ô¤·¡¢¥×¥ì¥¤¥ä¡¼¤Î°ÜÆ°¤Ë¹ç¤ï¤»¤Æ¥ß¥Ë¥Þ¥Ã¥×¤¬°ÜÆ°¤¹¤ë¤«¡¢³Îǧ¤ò¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡Â¿¤¯¤Î¥ß¥Ë¥Þ¥Ã¥×¤Î¾ì¹ç¡¢¥Þ¡¼¥«¡¼¤È¤¤¤¦·Á¤Ç¡¢¥²¡¼¥àÆâ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î¥¢¥¤¥³¥ó¤òɽ¼¨¤µ¤»¤Þ¤¹¡£
¥×¥ì¥¤¥ä¡¼¤Î¥¢¥¤¥³¥ó¡¢Å¨¤Î¥¢¥¤¥³¥ó¡¢¥¢¥¤¥Æ¥à¤Î¥¢¥¤¥³¥ó¡¢µòÅÀ¤Î¥¢¥¤¥³¥ó¤Ê¤É¡¢¥ß¥Ë¥Þ¥Ã¥×¤Ëɽ¼¨¤µ¤»¤¿¤¤¾ðÊó¤Ë±þ¤¸¤Æ¥Þ¡¼¥«¡¼¤òºîÀ®¤·¤Þ¤¹¡£
¡¡¥Þ¡¼¥«¡¼¤ÎºîÀ®ÊýË¡¤Ï¤É¤ì¤âƱ¤¸¤Ë¤Ê¤ê¤Þ¤¹¡£¤³¤³¤Ç¤Ï¥×¥ì¥¤¥ä¡¼¤Î¥Þ¡¼¥«¡¼¤ÎºîÀ®¤òÎã¤Ëµó¤²¤Þ¤¹¡£
¡¡¥×¥ì¥¤¥ä¡¼ÍѤΥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤È¤·¤Æ¡¢£²£Ä¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ò¿·¤·¤¯Äɲä·¤Þ¤¹¡£
¤³¤³¤Ç¤Ï Create ¢ª 2D Object ¢ª ±ß¾õ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Æ¤¤¤Þ¤¹¡£
¡¡Ì¾¾Î¤ÏǤ°Õ¤Ç¤¹¤¬¡¢Ê¬¤«¤ê¤ä¤¹¤¯ Marker ¤Î¤è¤¦¤ËÊѹ¹¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡¥Þ¡¼¥«¡¼ÍѤβèÁü¤Ë¤Ä¤¤¤Æ¤Ï¥ß¥Ë¥Þ¥Ã¥×¤Î¥¢¥¤¥³¥ó¤È¤Ê¤ê¤Þ¤¹¤Î¤Ç¡¢Å¬µ¹¤Ê²èÁü¤òÀßÄꤷ¤Æ¤¯¤À¤µ¤¤¡£
º£²ó¤Î¾ì¹ç¡¢½é´ü²èÁü¤ò¤½¤Î¤Þ¤ÞÍøÍѤ·¡¢¿§¤À¤±¤òÊѤ¨¤Æ»ÈÍѤ·¤Æ¤¤¤Þ¤¹¡£
¡¡¥ß¥Ë¥Þ¥Ã¥×¤ÎÌÜ°õ¤Ë¤Ê¤ì¤Ð¤è¤¤¤¿¤á¡¢ÌÜΩ¤Ä¹©Éפò¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
¡¡Â³¤¤¤Æ¡¢Layer ¤ÎÀßÄê¤ò GroundDetector ¤ËÊѹ¹¤·¤Þ¤¹¡£
¤³¤ÎÀßÄê¤Ë¤¹¤ë¤³¤È¤Ç¡¢MinimapCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤ÎÉÁ²èÂоݤȤʤê¤Þ¤¹¡£
¡¡°Ê¾å¤Ç¥Þ¡¼¥«¡¼¤Ï´°À®¤Ç¤¹¡£
¡¡¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¥Þ¡¼¥«¡¼¤¬É½¼¨¤µ¤ì¤Æ¤¤¤ë¤«¡¢³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¥×¥ì¥¤¥ä¡¼¤Î»Ò¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢¥×¥ì¥¤¥ä¡¼¤Î°ÌÃÖ¤ÈƱ¤¸°ÌÃ֤˥ޡ¼¥«¡¼¤¬É½¼¨¤µ¤ì¤Þ¤¹¡£
¡¡Unity ¤Î¿Æ»Ò´Ø·¸¤ò¾å¼ê¤¯³èÍѤ·¤Æ¤¤¤¤Þ¤·¤ç¤¦¡£
¡¡¸½ºß¤ÎÀßÄê¤Î¤Þ¤Þ¤Ç¤¹¤È¡¢¥²¡¼¥à²èÌ̤ÎÊý¤Ë¤â¥Þ¡¼¥«¡¼¤¬±Ç¤ê¤³¤ó¤Ç¤·¤Þ¤¦¤¿¤á¡¢
GroundDetector ¤ËÀßÄꤵ¤ì¤Æ¤¤¤ë Layer ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È(¥Þ¡¼¥«¡¼)¤Ë¤Ä¤¤¤Æ¤Ï¡¢MainCamera ¤Ë¤ÏÉÁ²è¤·¤Ê¤¤¤è¤¦¤ËÀßÄꤷ¤Þ¤¹¡£
¡¡MainCamera ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Î Camera ¥³¥ó¥Ý¡¼¥Í¥ó¥ÈÆâ¤Ë¤¢¤ë Culling Mask ¤Î¥×¥ë¥À¥¦¥ó¤òÁªÂò¤·¡¢
ÀßÄ꤫¤é GroundDetector ¤Î Layer ¤Î¥Á¥§¥Ã¥¯¤ò³°¤·¤Þ¤¹¡£
¡¡¤³¤ì¤Ë¤è¤ê¡¢MainCamera ¤Ç¤Ï¥Þ¡¼¥«¡¼¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÉÁ²è¤·¤Ê¤¤¾õÂ֤ˤʤê¤Þ¤¹¡£
¡¡¥²¡¼¥à¤ò¼Â¹Ô¤·¤Æ¡¢¥²¡¼¥à²èÌ̤«¤é¤Ï¥Þ¡¼¥«¡¼¤¬¾Ã¤¨¡¢¥ß¥Ë¥Þ¥Ã¥×¤Ë¤Î¤ß¥Þ¡¼¥«¡¼¤¬É½¼¨¤µ¤ì¤Æ¤¤¤ë¤«¡¢³Îǧ¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡MainCamera ¤Ë Cinemachine ¤òϢư¤µ¤»¤Æ¤¤¤ë¾ì¹ç¡¢Confiner ¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤è¤Ã¤Æ Cinemachine ¤Î²ÔƯÈϰϤòÀ©¸Â¤·¤Æ¤¤¤ë¥±¡¼¥¹¤¬¤¢¤ê¤Þ¤¹¡£
¤³¤Î¾ì¹ç¡¢¿·¤·¤¯ºîÀ®¤·¤¿ Ground ¤È GroundDetector ¤Î£²¤Ä¤Î Layer ¤¬ÀÜ¿¨¤·¤Æ¤·¤Þ¤¤¡¢Àµ¾ï¤ËÆ°ºî¤·¤Ê¤¤¶²¤ì¤¬¤¢¤ê¤Þ¤¹¡£
¡¡Æ±Íͤˡ¢¥×¥ì¥¤¥ä¡¼¡¢ÃÆ¡¢Å¨¤È¤¤¤Ã¤¿¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤â¤½¤ì¤¾¤ì¤Î Layer ¤òÀßÄꤷ¤Æ¤¤¤ë¾ì¹ç¡¢
¤³¤Î¿·¤·¤¤ Layer ¤¬´³¾Ä¤·¤Æ¥×¥ì¥¤¥ä¡¼¤äŨ¤¬°ÜÆ°¤Ç¤¤Ê¤¯¤Ê¤Ã¤¿¤ê¤·¤Þ¤¹¡£
¡¡¤³¤Î¥±¡¼¥¹¤ËÂбþ¤¹¤ë¤Ë¤Ï¡¢ProjectSettings ¢ª Physics2D ¤Î¹àÌÜÆâ¤Ë¤¢¤ë Layer Collision Matrix ¤ÎÀßÄê¤ò¸«Ä¾¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡¿·¤·¤¤ Layer ¤È¤Î´³¾Ä¤ò³°¤¹¤³¤È¤ÇÀµ¾ï¤ËÆ°ºî¤¹¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
ÀßÄêÎã
¡¡°Ê¾å¤Ç´°À®¤Ç¤¹¡£
¡¡Ä´À°¤·¤Ê¤¬¤é±þÍÑÊýË¡¤ò¹Í¤¨¤Æ¤ß¤ë¤ÈÎɤ¤¤Ç¤·¤ç¤¦¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯