第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問題,去搜搜看,總會(huì)有你想問的

Unity如何使游戲?qū)ο鬅o休止地通過航路點(diǎn)?

Unity如何使游戲?qū)ο鬅o休止地通過航路點(diǎn)?

C#
千萬里不及你 2021-04-29 18:11:13
我有以下代碼:using UnityEngine;using UnityEngine.AI;using System.Collections;public class AutoPilot : MonoBehaviour {public Transform[] points;private int destPoint = 0;private NavMeshAgent agent;void Start () {    agent = GetComponent<NavMeshAgent>();    // Disabling auto-braking allows for continuous movement    // between points (ie, the agent doesn't slow down as it    // approaches a destination point).    GotoNextPoint();}void GotoNextPoint() {    // Returns if no points have been set up    if (points.Length == 0)        return;    // Set the agent to go to the currently selected destination.    agent.destination = points[destPoint].transform.position;    // Choose the next point in the array as the destination,    // cycling to the start if necessary.    destPoint = (destPoint + 1) % points.Length;}void Update () {    // Choose the next destination point when the agent gets    // close to the current one.    if (!agent.pathPending && agent.remainingDistance < 2f)        GotoNextPoint();}}我經(jīng)過航路點(diǎn)的地方,代理跟蹤它們,但是當(dāng)我到達(dá)最后一個(gè)航路點(diǎn)時(shí),如何使它重新啟動(dòng)?繼續(xù)前進(jìn)?可以通過某種方式重置還是最好的方法是什么?
查看完整描述

1 回答

?
忽然笑

TA貢獻(xiàn)1806條經(jīng)驗(yàn) 獲得超5個(gè)贊

我通過添加以下內(nèi)容修復(fù)了該問題:


if (destPoint == points.Length) {

        destPoint = 0;

    }


查看完整回答
反對 回復(fù) 2021-05-08
  • 1 回答
  • 0 關(guān)注
  • 143 瀏覽

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)