MeatMotion

MMotion.Punch

Create a punch around a starting value, with a float, Vector2 or Vector3 strength.

Namespace
MeatMotion
Assembly
MeatMotion

Jump to members

public static class Punch
VibrationMotion.cs · L38

Return to the starting value

Add using MeatMotion;. The second argument is the strength. This punch returns to its starting value of 3 at the end of its one-second duration.

float value = 0f;
using var world = new MotionWorld();
var punch = MMotion.Punch.Create(3f, 2f, 1f)
    .WithFrequency(5).WithDampingRatio(1f)
    .WithScheduler(world).Bind(v => value = v);
punch.Complete();

Members

Create

Create a punch around a starting value, with a float, Vector2 or Vector3 strength.

public static MotionBuilder<float, PunchOptions, FloatPunchMotionAdapter> Create(float startValue, float strength, float duration)
Parameters and return value
startValue
float Starting value.
strength
float Oscillation strength relative to the starting value.
duration
float Duration in seconds.
Returns
MotionBuilder<float, PunchOptions, FloatPunchMotionAdapter>
public static MotionBuilder<Vector2, PunchOptions, Vector2PunchMotionAdapter> Create(Vector2 startValue, Vector2 strength, float duration)
Parameters and return value
startValue
Vector2 Starting value.
strength
Vector2 Oscillation strength relative to the starting value.
duration
float Duration in seconds.
Returns
MotionBuilder<Vector2, PunchOptions, Vector2PunchMotionAdapter>
public static MotionBuilder<Vector3, PunchOptions, Vector3PunchMotionAdapter> Create(Vector3 startValue, Vector3 strength, float duration)
Parameters and return value
startValue
Vector3 Starting value.
strength
Vector3 Oscillation strength relative to the starting value.
duration
float Duration in seconds.
Returns
MotionBuilder<Vector3, PunchOptions, Vector3PunchMotionAdapter>