Unity AI

引入unityengine.ai

给player加 Navagentmesh

public Navagentmesh player;

public transform target;

在start写

 

player=this.getcompent<navagentmesh>;

player.destination=target.position;

 

raycast hit;

if(physics.raycast(camera.main.screenPointToRay(Input.moousePosition),out hit,1000f)

player.destination=hit.position;

 

posted @ 2022-08-26 08:37  多见多闻  阅读(120)  评论(0)    收藏  举报