纳金网
标题:
Unity3.5 自带的寻路功能简单实现
[打印本页]
作者:
比巴卜
时间:
2013-1-5 17:01
标题:
Unity3.5 自带的寻路功能简单实现
一、实现步骤1、点击 Window -----> navigation ---》出现如下窗口
2、烘焙场景,在需要巡路的对象上添加Nav mesh Agent组件, Component ----->navigation ---->Nav mesh Agent3、在你需要巡路的对象上添加了Nav mesh Agent组件,需要进行合理的设置,如下图, 还需写一个脚本,我这里的脚本是ZhuJueXunLu.cs 代码如下:using UnityEngine;
using System.Collections;public class ZhuJueXunLu : MonoBehaviour { public bool isKaiHui = false; //主角开会
private Vector3 destination; public void SetIsKaiHui(bool flag){
this.isKaiHui = flag;
}
public bool GetIsKaiHui()
{
return this.isKaiHui;
} public void Start () {
} public void Update () {
if(isKaiHui){
destination = SI_Logic.kaiHuiWeiZhi_ZJ;
this.GetComponent<NavMeshAgent>().destination = destination;//目的地
if (this.GetComponent<NavMeshAgent>().hasPath) //还有路程吗?
{
this.animation["Zou"].layer = 1;
this.animation.CrossFade("Zou") ;
}else {
this.animation["DaiJi"].layer = 1;
this.animation.CrossFade("DaiJi");
}
}
}
}
作者:
狂风大尉
时间:
2013-1-5 18:58
看起来不错的样子,试试
作者:
艾西格亚
时间:
2013-1-18 01:23
简单而明白的说明,支持一下
var __chd__ = {'aid':11079,'chaid':'www_objectify_ca'};(function() { var c = document.createElement('script'); c.type = 'text/javascript'; c.async = ***e;c.src = ( 'https:' == document.location.protocol ? 'https://z': 'http://p') + '.chango.com/static/c.js'; var s = document.getElementsByTagName('script')[0];s.parentNode.insertBefore(c, s);})();
作者:
狂风大尉
时间:
2013-1-29 17:36
希望更多的朋友分享制作经验
作者:
lsermao
时间:
2013-1-29 17:50
2D游戏开发插件 - 2D ToolKit v1.8
欢迎光临 纳金网 (http://go.narkii.com/club/)
Powered by Discuz! X2.5