Documentation

Unity Engine

Download Unity

Unity Engine

Path(ReadOnlySpan<Vector2>, float)

Creates a corridor of a given width along a polyline, such as a road or a river.
Read time 1 minuteLast updated 22 days ago

Definition

public static TerrainRegion Path(ReadOnlySpan<Vector2> points, float width)

Parameters

The points of the polyline in meters. At least two. The region keeps its own copy.

width

The full width of the corridor in meters. Must be greater than zero.

Returns

Type

Description

TerrainRegionThe new region.

Remarks

A position belongs to the corridor when it lies closer than half of
width
to any segment of the polyline, so the ends and the bends of the corridor are rounded. Repeated points are allowed.