blob: d6534c9140ecc4ce80d677ff194c5abf2a39965e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;
[RequireComponent(typeof(NavMeshLink))]
public class UpdateNavMeshLink : MonoBehaviour
{
public Transform from;
public Transform to;
private NavMeshLink m_Link;
private void Awake()
{
m_Link = GetComponent<NavMeshLink>();
}
private void Update()
{
if (from == null || to == null)
return;
m_Link.startPoint = transform.InverseTransformPoint(from.position);
m_Link.endPoint = transform.InverseTransformPoint(to.position);
}
}
|