private SamplePathPosition ( int areaMask, float maxDistance, NavMeshHit &hit ) : bool | ||
areaMask | int | |
maxDistance | float | |
hit | NavMeshHit | |
return | bool |
public extern bool SamplePathPosition(int areaMask, float maxDistance, out NavMeshHit hit);
/// <summary>
public bool PassingThrough(Vector4 plane) { UnityEngine.AI.NavMeshHit hit; navMeshAgent.SamplePathPosition(-1, 2.5f, out hit); if(hit.distance==0.0f) return false; Vector3 next_pos = hit.position; Vector3 curr_pos = transform.position; // Test positions are on opposite sides of door plane. float s1 = Vector3.Dot(next_pos, plane) + plane.w; float s2 = Vector3.Dot(curr_pos, plane) + plane.w; return s1*s2<0.0f; }