Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


clamp

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int values.
Read time 7 minutesLast updated 4 days ago

Definition

clamp(int, int, int)

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int values.
public static int clamp(int valueToClamp, int lowerBound, int upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

intThe clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(int2, int2, int2)

Returns the result of a componentwise clamping of the int2 x into the interval [a, b], where a and b are int2 vectors.
public static int2 clamp(int2 valueToClamp, int2 lowerBound, int2 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

int2The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(int3, int3, int3)

Returns the result of a componentwise clamping of the int3 x into the interval [a, b], where x, a and b are int3 vectors.
public static int3 clamp(int3 valueToClamp, int3 lowerBound, int3 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

int3The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(int4, int4, int4)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are int4 vectors.
public static int4 clamp(int4 valueToClamp, int4 lowerBound, int4 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

int4The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(uint, uint, uint)

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint values.
public static uint clamp(uint valueToClamp, uint lowerBound, uint upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

uintThe clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(uint2, uint2, uint2)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint2 vectors.
public static uint2 clamp(uint2 valueToClamp, uint2 lowerBound, uint2 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

uint2The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(uint3, uint3, uint3)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint3 vectors.
public static uint3 clamp(uint3 valueToClamp, uint3 lowerBound, uint3 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

uint3The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(uint4, uint4, uint4)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are uint4 vectors.
public static uint4 clamp(uint4 valueToClamp, uint4 lowerBound, uint4 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

uint4The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(long, long, long)

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are long values.
public static long clamp(long valueToClamp, long lowerBound, long upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

longThe clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(ulong, ulong, ulong)

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are ulong values.
public static ulong clamp(ulong valueToClamp, ulong lowerBound, ulong upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

ulongThe clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(float, float, float)

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float values.
public static float clamp(float valueToClamp, float lowerBound, float upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

floatThe clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(float2, float2, float2)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float2 vectors.
public static float2 clamp(float2 valueToClamp, float2 lowerBound, float2 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

float2The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(float3, float3, float3)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float3 vectors.
public static float3 clamp(float3 valueToClamp, float3 lowerBound, float3 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

float3The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(float4, float4, float4)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are float4 vectors.
public static float4 clamp(float4 valueToClamp, float4 lowerBound, float4 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

float4The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(double, double, double)

Returns the result of clamping the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double values.
public static double clamp(double valueToClamp, double lowerBound, double upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

doubleThe clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(double2, double2, double2)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double2 vectors.
public static double2 clamp(double2 valueToClamp, double2 lowerBound, double2 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

double2The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(double3, double3, double3)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double3 vectors.
public static double3 clamp(double3 valueToClamp, double3 lowerBound, double3 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

double3The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].

clamp(double4, double4, double4)

Returns the result of a componentwise clamping of the value valueToClamp into the interval (inclusive) [lowerBound, upperBound], where valueToClamp, lowerBound and upperBound are double4 vectors.
public static double4 clamp(double4 valueToClamp, double4 lowerBound, double4 upperBound)

Parameters

valueToClamp

Input value to be clamped.

lowerBound

Lower bound of the interval.

upperBound

Upper bound of the interval.

Returns

Type

Description

double4The componentwise clamping of the input valueToClamp into the interval (inclusive) [lowerBound, upperBound].