Skip to content

NavMeshObstacle

extends Component

The NavMeshObstacle component is typically used on scene obstacle objects. When a navigation mesh agent encounters an obstacle, it will modify its path to bypass it, or if the obstacle completely blocks the path, it will search for an alternative route.

typescript
let obj = new GameObject();
let com = obj.AddComponent<NavMeshObstacle>(NavMeshObstacle);

成员变量

NavMeshObstacle.shape : NavMeshObstacleShape
The geometric shape of the obstacle in the scene.
NavMeshObstacle.center : Vector3
The offset of the obstacle's center point relative to the position of the bound GameObject.
NavMeshObstacle.size : Vector3
The length of the Box in the x, y, and z directions.
NavMeshObstacle.radius : number
The radius of the cylinder.
NavMeshObstacle.carvingMoveThreshold : number
The minimum distance between the new cutting position and the old cutting position of the obstacle.
NavMeshObstacle.height : number
Height of the cylinder.
NavMeshObstacle.carvingTimeToStationary : number
The minimum stationary time for triggering obstacle carving at a new position.
NavMeshObstacle.carveOnlyStationary : boolean
Whether to carve the navigation mesh only when the obstacle is in a stationary state.
NavMeshObstacle.carving : boolean
Whether the obstacle carves a hole in the navigation mesh.