Files
GameDevGameJamV2/Assets/Scripts/GizmosExtended.cs
OMGeeky 6ffa65dcb1 Movement & Attaching etc.
also cleanup
2022-05-22 01:56:22 +02:00

27 lines
880 B
C#

using UnityEngine;
public static class GizmosExtended
{
public static void DrawCubeWithLocalSpace( Vector3 center , float size , Transform transform )
{
var s = new Vector3( size , size , -1 );
Gizmos.matrix = Matrix4x4.TRS( transform.TransformPoint( Vector3.zero ) , transform.rotation , transform.lossyScale );
Gizmos.DrawCube( Vector3.zero , Vector3.one + s );
// var pUR = (Vector2) center + new Vector2( size.x , size.y );
// var pUL = (Vector2) center + new Vector2( -size.x , size.y );
// var pDR = (Vector2) center + new Vector2( size.x , -size.y );
// var pDL = (Vector2) center + new Vector2( -size.x , -size.y );
}
}
public static class Vector2Extension
{
public static Vector2 Rotate( this Vector2 v , float degrees )
{
return Quaternion.Euler( 0 , 0 , degrees ) * v;
}
}