Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


remap

Returns the result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
Read time 5 minutesLast updated 10 days ago

Definition

remap(float, float, float, float, float)

Returns the result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static float remap(float srcStart, float srcEnd, float dstStart, float dstEnd, float x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

floatThe remap of input x from the source range to the destination range.

remap(float2, float2, float2, float2, float2)

Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static float2 remap(float2 srcStart, float2 srcEnd, float2 dstStart, float2 dstEnd, float2 x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

float2The componentwise remap of input x from the source range to the destination range.

remap(float3, float3, float3, float3, float3)

Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static float3 remap(float3 srcStart, float3 srcEnd, float3 dstStart, float3 dstEnd, float3 x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

float3The componentwise remap of input x from the source range to the destination range.

remap(float4, float4, float4, float4, float4)

Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static float4 remap(float4 srcStart, float4 srcEnd, float4 dstStart, float4 dstEnd, float4 x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

float4The componentwise remap of input x from the source range to the destination range.

remap(double, double, double, double, double)

Returns the result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static double remap(double srcStart, double srcEnd, double dstStart, double dstEnd, double x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

doubleThe remap of input x from the source range to the destination range.

remap(double2, double2, double2, double2, double2)

Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static double2 remap(double2 srcStart, double2 srcEnd, double2 dstStart, double2 dstEnd, double2 x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

double2The componentwise remap of input x from the source range to the destination range.

remap(double3, double3, double3, double3, double3)

Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static double3 remap(double3 srcStart, double3 srcEnd, double3 dstStart, double3 dstEnd, double3 x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

double3The componentwise remap of input x from the source range to the destination range.

remap(double4, double4, double4, double4, double4)

Returns the componentwise result of a non-clamping linear remapping of a value x from source range [srcStart, srcEnd] to the destination range [dstStart, dstEnd].
public static double4 remap(double4 srcStart, double4 srcEnd, double4 dstStart, double4 dstEnd, double4 x)

Parameters

srcStart

The start point of the source range [srcStart, srcEnd].

srcEnd

The end point of the source range [srcStart, srcEnd].

dstStart

The start point of the destination range [dstStart, dstEnd].

dstEnd

The end point of the destination range [dstStart, dstEnd].

The value to remap from the source to destination range.

Returns

Type

Description

double4The componentwise remap of input x from the source range to the destination range.