This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System; | |
public class MathParabola | |
{ | |
public static Vector3 Parabola(Vector3 start, Vector3 end, float height, float t) | |
{ | |
Func<float, float> f = x => -4 * height * x * x + 4 * height * x; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public Vector3 shakePower = new Vector3(0.03f, 0.03f, 0.03f); | |
public float shakeDuration = 1f; | |
private IEnumerator ShakeRoutine() | |
{ | |
for (var t = 0f; t < shakeDuration; t += Time.unscaledDeltaTime) | |
{ | |
var offset = transform.rotation * Vector3.Scale(Random.onUnitSphere, shakePower); | |
transform.position += offset; |