Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace Common
- {
- using UnityEngine;
- using UnityEngine.AI;
- public static class NavMeshExtensions
- {
- public static Vector3 ToNavMesh
- (this Vector3 value, float maxDistance = float.MaxValue, int allAreas = NavMesh.AllAreas)
- =>
- NavMesh.SamplePosition(value, out NavMeshHit hit, maxDistance, allAreas)
- ? hit.position
- : value;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment