Created
February 7, 2020 04:25
-
-
Save Streamweaver/ba88276fdc0d7d5330bbaadc07ee4bf6 to your computer and use it in GitHub Desktop.
A simple set of static utilities I'm building up during Unity .
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; | |
namespace Streamweaver.Util | |
{ | |
public static class StaticUtils | |
{ | |
public static Vector3 GetRandomDir2D() | |
{ | |
return new Vector3(Random.Range(-1f, 1f), Random.Range(-1f, 1f), 0).normalized; | |
} | |
public static Vector3 GetVectorFromAngle(int angle) | |
{ | |
float angleRad = angle * Mathf.Deg2Rad; | |
return new Vector3(Mathf.Cos(angleRad), Mathf.Sin(angleRad)); | |
} | |
public static Vector3 GetVectorFromAngle(float angle) | |
{ | |
float angleRad = angle * Mathf.Deg2Rad; | |
return new Vector3(Mathf.Cos(angleRad), Mathf.Sin(angleRad)); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment