ºÇ½ª¹¹¿·¡§ orika_ex_miyako 2022ǯ03·î23Æü(¿å) 15:59:11ÍúÎò
¼Â¹ÔÆ°²è
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡°Ê²¼¤ÎÆâÍƤǽçÈ֤˼ÂÁõ¤ò¿Ê¤á¤Æ¤¤¤¤Þ¤¹¡£
¼ê½ç£±£²¡¡¡¼Ì£Êý¥¥ã¥é¤Î°ÜÆ°·ÐÏ©¤Îɽ¼¨µ¡Ç½¤Î¼ÂÁõ¡Ý
£±£¸¡¥°ÜÆ°·Ðϩɽ¼¨ÍѤΥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤¹¤ë £±£¹¡¥DrawPath ¥¹¥¯¥ê¥×¥È¤òºîÀ®¤¹¤ë £²£°¡¥MoveToClickTileMapPoint ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¡¢°ÜÆ°»þ¤Ë°ÜÆ°·ÐÏ©¤Îɽ¼¨¤ò¹Ô¤¦µ¡Ç½¤ò¼ÂÁõ¤¹¤ë
¡¡¿·¤·¤¤³Ø½¬ÆâÍƤϡ¢°Ê²¼¤ÎÄ̤ê¤Ç¤¹¡£
¡¡¡¦LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È
¡¡¥¥ã¥é¤Î°ÜÆ°·ÐÏ©¤òɽ¼¨¤¹¤ë¤¿¤á¡¢°ÜÆ°·Ðϩɽ¼¨ÍѤΥ²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òºîÀ®¤·¤Þ¤¹¡£
¡¡·ÐÏ©¤Îɽ¼¨¤Ï LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤È LineRenderer ÍѤ˺îÀ®¤¹¤ë¥Þ¥Æ¥ê¥¢¥ë¤Ë¤è¤Ã¤Æ¹Ô¤¤¤Þ¤¹¡£
¡¡LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ç¤Ï¡¢ÄºÅÀ¤Î¿ô¤Ë¹ç¤ï¤»¤ÆľÀþ¤Î¥²¡¼¥à¥ª¥Ö¥¸¥§¥¯¥È¤òÉÁ²è¤·¤Þ¤¹¡£
Î㤨¤Ð¡¢A(x = 0, y = 0) ¤È B(x = 5, y = 0) ¤È¤¤¤¦ÄºÅÀ¾ðÊ󤬤¢¤ë¾ì¹ç¡¢±¦¾åÊý¸þ¤Ë¸þ¤±¤¿Ä¾Àþ¤òÉÁ²è¤·¤Þ¤¹¡£
¡¡¥¥ã¥é¤Î°ÜÆ°¤ËÍøÍѤ·¤Æ¤¤¤ë NavMeshAgent ¤Ë¤Ï¡¢³Æ·ÐÏ©¤Î°ÌÃÖ¾ðÊ󤬥¹¥¿¡¼¥ÈÃÏÅÀ¤«¤é¥´¡¼¥ëÃÏÅÀ¤Þ¤Ç¤¹¤Ù¤ÆÊÝ»ý¤µ¤ì¤Æ¤¤¤Þ¤¹¤Î¤Ç¡¢
¤³¤Î¾ðÊó¤òĺÅÀ¾ðÊó¤È¤·¤Æ³èÍѤ·¡¢LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤È NavMeshAgent ¤Î·ÐÏ©¤Î°ÌÃÖ¾ðÊó¤òÁȤ߹ç¤ï¤»¤ë¤³¤È¤Ç
¥¥ã¥é¤Î°ÜÆ°·ÐÏ©¤ÈƱ¤¸ÆâÍƤΰÜÆ°·ÐÏ©¤ÎÉÁ²è¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤ò¥¢¥¿¥Ã¥Á¤·¤¿¤À¤±¤Ç¤Ï¥é¥¤¥óÉÁ²è¤ò¹Ô¤¦¤³¤È¤Ï½ÐÍè¤Þ¤»¤ó¤Î¤Ç¡¢
¥é¥¤¥óÉÁ²èÀìÍѤΥ¹¥¯¥ê¥×¥È¤òºîÀ®¤·¡¢¤³¤ÎÃæ¤Ç LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÀ©¸æ¤·¤Æ¥é¥¤¥óÉÁ²è¤ò¹Ô¤¦¤è¤¦¤Ë¤·¤Þ¤¹¡£
¡¡Line Renderer (¥é¥¤¥ó¥ì¥ó¥À¥é¡¼) ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤Ï¡¢¶õ´Ö¤Î£²¤Ä°Ê¾å¤ÎÅÀ¤ÎÇÛÎó¤ò¤È¤ë¤³¤È¤Ç¡¢¤½¤ì¤¾¤ì¤Î´Ö¤ËľÀþ¤òÉÁ¤¤Þ¤¹¡£
¸ø¼°¥µ¥¤¥È¤Ë¤Ï £³£Ä ¤È¤¢¤ê¤Þ¤¹¤¬¡¢£²£Ä¤Ç¤â±þ¤·¤Æ³èÍѤ·¤Æ¤¤¤¯¤³¤È¤¬²Äǽ¤Ç¤¹¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥Þ¥Ë¥å¥¢¥ë
LineRenderer
https://docs.unity3d.com/ja/current/Manual/class-L...
Unity ¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
LineRenderer
https://docs.unity3d.com/jp/current/ScriptReferenc...
¡¡º£²ó¼ÂÁõ¤·¤Æ¤¤¤ëÊÑ¿ô¤ä¥á¥½¥Ã¥É¤Ë¤Ä¤¤¤Æ¤Þ¤È¤á¤Æ¤ª¤¤Þ¤¹¡£
ɬ¤º¼«Ê¬¤Ç¤âÄ´¤Ù¤Æ¡¢¼«Ê¬¤ÎÃμ±¤È¤·¤ÆµÛ¼ý¤·¤Æ¤ª¤¤¤Æ¤¯¤À¤µ¤¤¡£
¡¡LineRenderer ¤ÇÉÁ²è¤¹¤ë¥é¥¤¥ó¤ÎÉý¤Î¥¹¥¿¡¼¥È¤Î¥µ¥¤¥º¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ëÊÑ¿ô¤Ç¤¹¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
LineRenderer.startWidth
https://docs.unity3d.com/jp/current/ScriptReferenc...
¡¡LineRenderer ¤ÇÉÁ²è¤¹¤ë¥é¥¤¥ó¤ÎÉý¤ÎºÇ¸å¤Î¥µ¥¤¥º¤òÀßÄꤹ¤ë¤³¤È¤¬¤Ç¤¤ëÊÑ¿ô¤Ç¤¹¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
LineRenderer.endWidth
https://docs.unity3d.com/jp/current/ScriptReferenc...
¡¡¤³¤ì¤é¤Î¾¤Ë¤â¡¢¿§¤òÊѹ¹¤¹¤ëÊÑ¿ô¤ä¡¢¶ÊÀþ¤òÉÁ¤¯¤¿¤á¤ÎÊÑ¿ô¤Ê¤É¤âÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¡£
¡¡LineRenderer ¤ÇÉÁ²è¤¹¤ë¥é¥¤¥ó¤ÎĺÅÀ¿ô¤òÀßÄꤷ¤¿¤ê¡¢»²¾È¤·¤¿¤ê¤¹¤ë¤³¤È¤¬¤Ç¤¤ëÊÑ¿ô¤Ç¤¹¡£
¡¡// ·ÐÏ©¤ÎĺÅÀ¿ô¤ÎÀßÄê line.positionCount = corners.Length;
¡¡º£²ó¤ÏÂåÆþ½èÍý¤ò¹Ô¤¤¡¢ÄºÅÀ¿ô¤ÎÀßÄê¤ò¹Ô¤Ã¤Æ¤¤¤Þ¤¹¡£corners.Length ¤ÎÃͤϰÜÆ°·ÐÏ©¤ÎĺÅÀ¤Î¿ô¤Ç¤¢¤ê¡¢²ÄÊѤ¹¤ëÃͤǤ¹¡£
¤½¤Î¤¿¤á¡¢¥é¥¤¥ó¤òÀ¸À®¤¹¤ë¤¿¤á¤ÎĺÅÀ¿ô¤òËè²ó¤³¤ÎÉôʬ¤Ç¥»¥Ã¥È¤·¤ÆÀßÄꤷ¤Þ¤¹¡£
¤³¤ÎÊ£¿ô¤ÎĺÅÀ¤ò·ë¤Ö¤³¤È¤Ç¥é¥¤¥ó¤òÀ¸À®¤·¤Þ¤¹¡£¤³¤³¤Ç¤Ï¤½¤Î¤¿¤á¤Î½àÈ÷¤ò¤·¤Æ¤¤¤Þ¤¹¡£
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
LineRenderer.positionCount
https://docs.unity3d.com/jp/current/ScriptReferenc...
¡¡¥é¥¤¥ó¤ÎĺÅÀ¤Î°ÌÃÖ¤ò¤¹¤Ù¤ÆÀßÄꤹ¤ë¥á¥½¥Ã¥É¤Ç¤¹¡£¤³¤Î½èÍý¤Ë¤è¤Ã¤ÆÉÁ²è½èÍý¤¬¼Â¹Ô¤µ¤ì¤Þ¤¹¡£
SetPosition ¥á¥½¥Ã¥É¤È¤¤¤¦½èÍý¤âÍÑ°Õ¤µ¤ì¤Æ¤¤¤Þ¤¹¤¬¡¢¥ê¥Õ¥¡¥ì¥ó¥¹¤Ë¤â¤¢¤ë¤è¤¦¤Ë¡¢Ê£¿ô¤Î¥é¥¤¥ó¤òÉÁ²è¤¹¤ë¾ì¹ç¤Ë¤Ï¤³¤Á¤é¤Î½èÍý¤ÎÍøÍѤ¹¤ë¤è¤¦¤Ë¤·¤Æ¤¯¤À¤µ¤¤¡£
¡¡// ·ÐÏ©¤Îɽ¼¨(ÉÁ²è) line.SetPositions(corners);
»²¹Í¥µ¥¤¥È
Unity ¸ø¼°¥¹¥¯¥ê¥×¥È¥ê¥Õ¥¡¥ì¥ó¥¹
LineRenderer.SetPositions
https://docs.unity3d.com/jp/current/ScriptReferenc...
¡¡¤½¤Î¤Û¤«¤Î³èÍÑ»öÎã¤ò¾Ò²ð¤·¤Æ¤¤¤ë¥µ¥¤¥È¤â¤¿¤¯¤µ¤ó¤¢¤ê¤Þ¤¹¤Î¤Ç¡¢¼«Ê¬¤Ç¤â¸¡º÷¤·¤Æ¤ß¤Æ¤¯¤À¤µ¤¤¡£
»²¹Í¥µ¥¤¥È
¤Ï¤Ê¤Á¤ë¤Î¥Þ¥¤¥Î¡¼¥È ÍÍ
¡ÚUnity¡ÛLineRenderer¤ò¥¹¥¯¥ê¥×¥È¤«¤é¼«Í³¼«ºß¤ËÁà¤ë
https://www.hanachiru-blog.com/entry/2020/10/05/12...
¡¡·ÐÏ©¤Î¾ðÊó¤ò´ÉÍý¤·¤Æ¤¤¤ë MoveToClickTileMapPoint ¥¹¥¯¥ê¥×¥È¤ò½¤Àµ¤·¡¢·ÐÏ©¤Î¾ðÊó¤òÀèÄøºîÀ®¤·¤¿ DrawPath ¥¹¥¯¥ê¥×¥È¤Î DrawCornersLine ¥á¥½¥Ã¥É¤ò¼Â¹Ô¤·¤Æ
·ÐÏ©¤Î¾ðÊó¤ò DrawPath ¥¹¥¯¥ê¥×¥È¤ØÅϤ¹½èÍý¤òÄɲä·¤Þ¤¹¡£
¡¡¤³¤Î½èÍý¤Ë¤è¤ê¡¢¥¥ã¥é¤Î°ÜÆ°·ÐÏ©¤ÈƱ¤¸·ÐÏ©¤Î¾ðÊó¤¬ DrawPath ¥¹¥¯¥ê¥×¥È¤Ç¤âÍøÍѤǤ¤ë¤³¤È¤Ë¤Ê¤ê¡¢
DrawPath ¥¹¥¯¥ê¥×¥È¤¬ LineRenderer ¥³¥ó¥Ý¡¼¥Í¥ó¥È¤òÍøÍѤ·¤Æ¥é¥¤¥óÉÁ²è¤ò¹Ô¤¦¤³¤È¤Ç¡¢°ÜÆ°·ÐÏ©¤ÈƱ¤¸¾ðÊó¤Î¥é¥¤¥ó¤òÀ¸À®¤¹¤ë¤³¤È¤¬½ÐÍè¤ë¤è¤¦¤Ë¤Ê¤ê¤Þ¤¹¡£
¡¡°ú¿ô¤Ë·ÐÏ©¤Î³ÆĺÅÀ¾ðÊó¤òÅϤ·¤Æ¤¤¤ë¤¿¤á¡¢¤½¤ÎÅÔÅÙ¡¢°ÜÆ°·ÐÏ©¤Î¾ðÊó¤òÍѤ¤¤Æ¥é¥¤¥óÉÁ²è¤¬¹Ô¤¨¤ë¥í¥¸¥Ã¥¯¤Ë¤Ê¤Ã¤Æ¤¤¤Þ¤¹¡£
¡¡¥²¡¼¥à¤ò¼Â¹Ô¤·¡¢¤¤¤Þ¤Þ¤Ç¤ÈƱ¤¸¤è¤¦¤Ë°ÜÆ°¤·¤¿¤¤ÃÏÅÀ¤ò¥¯¥ê¥Ã¥¯¤·¤Æ¤¯¤À¤µ¤¤¡£
¥¥ã¥é¤Î°ÜÆ°¤Ë¹ç¤ï¤»¤Æ¡¢ÌÜɸÃÏÅÀ¤Þ¤Ç¤Î°ÜÆ°·ÐÏ©¤¬É½¼¨¤µ¤ì¤ë¤è¤¦¤Ë¤Ê¤ì¤ÐÀ©¸æÀ®¸ù¤Ç¤¹¡£
¼Â¹ÔÆ°²è
Æ°²è¥Õ¥¡¥¤¥ë¤Ø¤Î¥ê¥ó¥¯
¡¡°Ê¾å¤Ç¤³¤Î¼ê½ç¤Ï½ªÎ»¤Ç¤¹¡£
¡¡¼¡¤Ï¡¡¼ê½ç£±£³¡¡¡Ý¡Ý?¡¡¤Ç¤¹¡£
- ¥«¥Æ¥´¥ê¡§
- ¿Ê³Ø/¥¹¥¯¡¼¥ë
- ¥×¥í¥°¥é¥ß¥ó¥°
¥³¥á¥ó¥È¤ò¤«¤¯