zoukankan      html  css  js  c++  java
  • Unity学习记录 导航

    vs 智能提示开关:

    选择External Tools,将External Script Editor选项改为Visual Studio

    1、将导航地图和障碍物 的设置为navigation static,记得要 blake 

    2、给player 添加 NavMeshAgent 组件

    3、通过组件获得主角,

    agent = GetComponent<NavMeshAgent>();

    4、射线获得点击点

            // 1为右键
            if (Input.GetMouseButtonDown(1))
            {
                //射线
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;
                // 此处使用碰撞处理,可以获得所有的点击“导航范围内”物体对应的坐标
                bool res = Physics.Raycast(ray, out hit,100f);
                if (res)
                {
                    agent.SetDestination(hit.point);
                }
            }

    C# 书写还是很舒服的。

  • 相关阅读:
    QTP err.number
    QTP参数化
    QTP基础
    QTP脚本补录
    QTP添加对象入库
    系统自带计算器自动化
    QTP安装
    App 测试
    本地化和国际化测试
    剑桥雅思写作高分范文ESSAY30
  • 原文地址:https://www.cnblogs.com/mitang/p/15712991.html
Copyright © 2011-2022 走看看