Search Unity

No Random.onUnitCircle?

Discussion in 'Scripting' started by CodeMonke234, Jul 1, 2015.

  1. CodeMonke234

    CodeMonke234

    Joined:
    Oct 13, 2010
    Posts:
    181
    There is
    insideUnitCircle Returns a random point inside a circle with radius 1 (Read Only).
    insideUnitSphere Returns a random point inside a sphere with radius 1 (Read Only).
    onUnitSphere Returns a random point on the surface of a sphere with radius 1 (Read Only).

    what happened to OnUnitCircle?

    Did someone just forget to put it in?
     
  2. CodeMonke234

    CodeMonke234

    Joined:
    Oct 13, 2010
    Posts:
    181
    ...
    float force = 600.0f;
    float angle = Random.Range(0, 2f * Mathf.PI);
    float x = Mathf.Cos(angle) * force;
    float y = Mathf.Sin(angle) * force;
     
  3. Baste

    Baste

    Joined:
    Jan 24, 2013
    Posts:
    4,423
    Vector2 onUnitCircle = Random.insideUnitCircle.normalized;
     
    Kiwasi and CodeMonke234 like this.
  4. CodeMonke234

    CodeMonke234

    Joined:
    Oct 13, 2010
    Posts:
    181
    nice!