Assets/Scripts/Ingame/Player.cs
/// <summary>
/// Gets angle on circle in degrees (0-360)
/// </summary>
/// <returns></returns>
Gets angle on circle in degrees (0-360)
Gets angle on circle in degrees ( 0 - 360 )
protected float GetCurrentAngleOnCircle()
        {
            Vector2 c = currentPlanet.transform.position; 
            Vector2 p = transform.position;
            float orbitRadius = currentPlanet.Radius + radius;
            Vector2 diff = (p - c) / orbitRadius;
            float theta_rad = Mathf.Atan2(diff.y, diff.x);
            float theta_deg = theta_rad * Mathf.Rad2Deg;
            if (theta_deg < 0.0)
            {
                theta_deg += 360.0f;
            }
            return theta_deg;
        }
protected float GetCurrentAngleOnCircle ( ) { Vector2 c = currentPlanet . transform . position ; Vector2 p = transform . position ; float orbitRadius = currentPlanet . Radius + radius ; Vector2 diff = ( p - c ) / orbitRadius ; float theta_rad = Mathf . Atan2 ( diff . y , diff . x ) ; float theta_deg = theta_rad * Mathf . Rad2Deg ; if ( theta_deg < 0.0 ) { theta_deg += 360.0f ; } return theta_deg ; }
Gets angle on circle in degrees (0-360)
Gets angle on circle in degrees ( 0 - 360 )
// center pos
None