Table of Contents

Class MathHelpers

Namespace
BSGameLib.Game
Assembly
BSGameLib.Game.dll

Helpers for moving values towards a target, easing curves, and angles.

public static class MathHelpers
Inheritance
MathHelpers
Inherited Members

Methods

Approach(Vector2, Vector2, float)

Moves value in a straight line towards target by at most delta. Returns target when it is within delta of it.

public static Vector2 Approach(Vector2 value, Vector2 target, float delta)

Parameters

value Vector2
target Vector2
delta float

Returns

Vector2

Approach(float, float, float)

Moves value towards target by at most delta, and never past it.

public static float Approach(float value, float target, float delta)

Parameters

value float
target float
delta float

Returns

float

CubeIn(float)

The cubic ease-in curve, slow at the start, for t from 0 to 1.

public static float CubeIn(float t)

Parameters

t float

Returns

float

CubeInOut(float)

The cubic ease-in-out curve, slow at both ends, for t from 0 to 1.

public static float CubeInOut(float t)

Parameters

t float

Returns

float

CubeOut(float)

The cubic ease-out curve, slow at the end, for t from 0 to 1.

public static float CubeOut(float t)

Parameters

t float

Returns

float

Normal(Vector2)

Returns value scaled to a length of 1. Returns zero when value has no length.

public static Vector2 Normal(this Vector2 value)

Parameters

value Vector2

Returns

Vector2

SmoothStep(float, float, float)

Returns the smooth step from 0 to 1 at t between min and max, clamped to 0 and 1 outside that range. The result is not defined when min equals max.

public static float SmoothStep(float min, float max, float t)

Parameters

min float
max float
t float

Returns

float

ToRadians(int)

Converts degrees to radians.

public static float ToRadians(int degrees)

Parameters

degrees int

Returns

float