public static Direction FromVector( Vector3 v ) { float angle = v.AngleFromForward (); if ( angle >= 0 && angle < 45 ) return Direction.TopRight; if ( angle >= 45 && angle < 135 ) return Direction.BottomRight; if ( angle >= 135 && angle < 225 ) return Direction.BottomLeft; if ( angle >= 225 && angle < 315 ) return Direction.TopLeft; if ( angle >= 315 ) return Direction.TopRight; return Direction.None; }