ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 20FEB19 NavMeshAgent
    C#/Unity 2019. 2. 20. 21:13

     

     

    대충 plane 과 cube로 땅과 장애물을 만들고 1) static 설정, 2) window>>AI>>Navigation 컴포넌트를 추가해 3) Bake 한다.

    - 이 과정이 되게 오래걸린다. 맵 Scale 을 줄이면 시간을 줄일 수 있다고 한다.

     

    파란색 큐브는 Human, 빨간색은 지렁이이다.

     

    Human 은 간단한 코드로 화살표로 움직일 수 있도록 하자.

     

    지렁이에는 Add Component>>Nav Mesh Agent를 추가한다.

     

     

    변수는 다음과 같다.

    acceleration 최대 가속도를 나타냅니다.
    angularSpeed 최대 회전 속도를 나타냅니다. (deg/s 단위).
    areaMask 이동할 수 있는 NavMesh 영역을 지정합니다. /areaMask/를 변경하면, 경로의 효율이 나빠지게 됩니다. (isPathStale 확인)
    autoBraking Should the agent brake automatically to avoid overshooting the destination point?
    autoRepath 가지고있는 경로(path)가 더이상 유효하지 않거나 Agent가 부분적인 경로에 도달해서 해당 경로가
    autoTraverseOffMeshLink OffMeshLinks의 움직임 자동화 기능을 활성화 또는 비활성화 합니다.
    avoidancePriority The avoidance priority level.
    baseOffset 상대적 수직 이동을 나타냅니다.
    currentOffMeshLinkData 현재 OffMeshLinkData를 추출합니다.
    desiredVelocity 회피를 고려한 NavMeshAgent의 목표 속도를 나타냅니다. (읽기전용)
    destination Gets or attempts to set the destination of the agent in world-space units.
    hasPath 해당 Agent가 현재, 경로(path)를 가지고 있는지를 확인합니다.
    height Agent의 높이를 나타냅니다.
    isOnNavMesh Is the agent currently bound to the navmesh? (Read Only)
    isOnOffMeshLink 해당 Agent가 현재 OffMeshLink에 위치해 있는지를 확인합니다.
    isPathStale 현재 경로(path)가 오래되었는지를 확인합니다.
    nextOffMeshLinkData The next OffMeshLinkData on the current path.
    nextPosition Gets or sets the simulation position of the navmesh agent.
    obstacleAvoidanceType 회피기능의 품질 레벨을 나타냅니다.
    path 현재 경로를 복사하거나 설정합니다.
    pathPending 계산중이지만 아직 준비가 되지 않는 경로(path)를 나타냅니다.
    pathStatus 현재 경로(path)의 상태를 요청합니다.
    radius Agent의 반경(radius)을 나타냅니다.
    remainingDistance 현재 경로(path)에서 남아있는 거리를 나타냅니다.
    speed 최대 이동 속도를 나타냅니다.
    steeringTarget Get the current steering target along the path. (Read Only)
    stoppingDistance 목표 위치부터 현재의 위치까지 내의 거리에서 멈춥니다.
    updatePosition Gets or sets whether the transform position is synchronized with the simulated agent position. The default value is true.
    updateRotation 해당 Agent가 트랜스폼 방향을 업데이트 해야하는지를 나타냅니다. (boolean 값)
    velocity NavMesh Agent 컴포넌트의 현재 속도를 나타냅니다.

    'C# > Unity' 카테고리의 다른 글

    19FEB19 길찾기-A* algorithm  (0) 2019.02.19
    13FEB19 terrain  (0) 2019.02.13
    06FEB19_GameObject.Find()  (0) 2019.02.07
    particle system  (0) 2019.02.05
    unity billiard  (0) 2019.01.20
Designed by Tistory.