Documentation

Unity Engine

Download Unity

Unity Engine

GetWeight(Vector2, float)

Gets how strongly an edit of this region applies at a position.
Read time 1 minuteLast updated 22 days ago

Definition

public float GetWeight(Vector2 position, float falloff)

Parameters

position

The position in meters.

falloff

The fraction of the region, from 0 to 1, over which the weight fades at its edge. 0 gives a hard edge.

Returns

Type

Description

floatThe weight, from 0 to 1.

Remarks

The weight is 1 inside the region and 0 outside it. With a falloff, it fades smoothly (smoothstep) from 1 to 0 towards the edge of the region, over that fraction of the half size of a rectangle, the radius of a disc, or the half width of a corridor.