NavMesh
èªåè»ãNavMeshã®ä¸ã§ã®WayPointå·¡åã«åãæ¿ãããããã§ãã©ãã¯ãå庫ãããåºã«ç§»åããããã§ããã¯ãã ããã¨ãæ©è¡è ã15人ãããSpawnããããã«ãããç²ããã¨èµ°ãã®ãè¾ãã¦æ©ãå§ãããæ¤ åã«åº§ãã¨å復ãã¦ã¾ãèµ°ãåºããNavMeshSurfaceã ã¨ãâ¦
ä¿¡å·è¿½å ãã¦ã¿ã ã¾ã ãæ¢ã¾ãã¿ã¤ãã³ã°ãé ãã£ãããå¾ç¶è»ã«æ¼ããã¦æ¨ªææ©éã«ä¹ãä¸ããããã å è¡è»ã¨æ¥è§¦ãããåè»ãã¦ãonColisionExit()ã§åçºè»ã«ãã¦ããã©ãå è¡è»ãèµ°ãåºããã®ã«ãå¾ç¶è»ã®Exitã¤ãã³ããçºçããªãå ´åãé »ç¹ã«çºçãã â¦
横ææ©éããªãéè·¯ãnot walkbleã«ãã¦ãnavMeshçã«ç§»åä¸å¯ã«ãã¦ã横ææ©éã渡ã£ã¦éè·¯ã横åãããã«ãã è»ã¯ã¨ããããWayPointå·¡å次ã«è¿½å ãããã®ã¯ã ä¿¡å· è»ã¨äººéã®è¡çª è»ã人éãæ¤ç¥ãã¦è¡çªãåé¿
3人ã§ç§»åããã®ã§å¾ããæ¥ã人ã«æ¼ããã¦2éããå°é¢ã«è½ã¡ãå ´åããã 次ã¯WayPointãå ¥ãã¦å·¡åããã¦ã¿ãããªï¼ ã§ãæ¤ åãè¦ã¤ããã¨ç²ããã座ã£ã¦ä¼ãã¿ãããªã NPC Populator ã¢ããæ©ãåã$10ã¢ã»ãããåç»è¦ã¦ããæãã ã£ããã§è²·ã£ã¦ã¿ããâ¦
試ãã試ããã¨æããªããæ°å¹´çµã£ã¦ãã¾ã£ã。・ï¾ï½¥(ï¾â`)ï½¥ï¾ï½¥ï½¡ ãã£ã¨å®é¨ãã¾ãããã¦ã¹ã§ã¯ãªãã¯ããå ´æã«ã¨ã¼ã¸ã§ã³ããåããã å£ãåããã¦ãçµè·¯å¤æ´ã«å¯¾å¿ãã¦ç§»åã§ãããã¦ã¹ã§ã¯ãªãã¯ãããæ¹ãã¦NavMeshãbakeãç´ãã¦ã¾ããnavMeshã®çµè·¯ã®ç´°ãâ¦
çµæ§ãä¿¡å·æ©ã£ã¦ãããããã ã³ã©ã¤ãã¼ãä¿¡å·æ©ã®ããå ´æã«è¨ç½®ãã¦ãâç§ã§èµ¤ã¨éï¼è»ã«ã¨ã£ã¦ï¼ãåãæ¿ããã ã³ã©ã¤ãã¼ã«æ¥è§¦ãããã¤èµ¤ä¿¡å·æ©ã®æ¹ãåãã¦ãããªããè»ã¯åè» ã³ã©ã¤ãã¼ã«æ¥è§¦ãããã¤èµ¤ä¿¡å·æ©ã®æ¹ãåãã¦ãããªãã人ã¯é²ãï¼è»â¦
ãããªãã§ãããã¨æã£ããã¯ã¾ãã¾ããã navMeshAgentã§speed=20ãããã«ããã¨ã³ã¼ãã¼ãæ²ããããã¾ããã ä»ã¾ã§ã¿ããã«é ããªãæ®éã«æ²ããã¾ãã AutoBrakingã¯ããã¾ããããã§ã足ãã¾ããã å é¨çã«rigidbody使ã£ã¦ããã§ãããï¼ é å¿åã®å½±â¦
ã¬ã³ãã¬ã¼ãã»ãã¼ãï½·ï¾ââââ(ï¾âï¾)ââââ!! ã¾ã³ãããããã¯ããã¼ãã¼ã«å¨ã ããã¿ã¼ã²ããã«ãã¦ããã®ã§è¿ãã«æ¥ãã¨SetDestinationããã®ã§ãçµè·¯ãã¹ãå¯è¦åãã¦ã¿ãã ã¾ãã§ããè¦ç·ãªãã ããçµè·¯ã§æ²ãã£ã¦ãå¿ è¦ã¯ãªãæ°ãããã ããããµã¤ã³ããâ¦
NavMeshã«ã¤ãã¦ä¸éãå¦ç¿ä¸ã ã¹ãã¼ãã®ããçµè·¯ãä½ã£ã¦ãå®æå·¡åã®ã³ã¼ããä½ãã¾ããã ã¾ã³ããªã®ã§ãã¿ã¼ã²ãããè¿ãå ´åã¯ãå®æå·¡åãå¤ãã¦ãã£ã¡ã«è¥²ã£ã¦ããã StandardAssetã®Toonã·ã§ã¼ãã¼ãããæãï¼ é«åº¦å·®ã®ããçµè·¯ã§Bakeãã¾ãã å®â¦
æ¨æ¥ã®SDã¦ããã£ã¡ããã§å¦ãã NavMeshãAIã¿ã³ã¯ã«é©ç¨ãã¦ã¿ã¾ããã ã¾ããããã«Navigationãbakeãã¾ãã ã©ã³ãã ã«ç»é¢ä¸ã«ã¿ã¼ã²ãããé ç½®ã ç»é¢ä¸ã«ã¯ãªãã¯ããä½ç½®ã«AIã¿ã³ã¯ãé ç½®ã§ãã¾ãã ã¿ã³ã¯ã¯è¿ãã®ã¿ã¼ã²ããã«å¯¾ãã agent.SetDestâ¦
NavMeshãåãã¦ãã£ã¦ã¿ã¾ãããäºãçµè·¯æ¢ç´¢ããã£ã¦ããã¦ãå®è¡æã«æççµè·¯ã§ç§»åãããããä»çµã¿ã§ãã åãããé害ç©ãè¨å®ã§ããããã§ãããã使ãã¨åçã«å¤åããç°å¢ãå®ç¾ã§ããã®ã§ãã£ã¦ã¿ããã¨æãã¾ããã ãã¡ãã®è¨äºãåèã«ããã¦ãâ¦