I am trying to develop a game in Unity where you jump from 2D planet to 2D planet, each with its own gravitational pull (The game is 2.5D, technically, but all movement is along the X and Y axes). I would like to place landmines at random points along these planets using the parametric formula; this is the script that I've developed to attach them to the parent Planet object. However, mines are not appearing at the surface of the circles as expected, and are instead appearing very distorted in shape. What might I be doing wrong?
public class LandMine : MonoBehaviour { public GameObject mine; private GameObject landmine; private System.Random rand; private Vector3 pos; List<GameObject> mines; public void Start() { mines = new List<GameObject>(); LevelStart(); } public Vector3 ran() { rand = new System.Random(359); float angle = rand.Next(); float value = angle * (Mathf.PI/180f); float x = (float) (0.5000001 * Mathf.Cos(value)) + 6; float y = (float) (0.5000001 * Mathf.Sin(value)) - 9; return new Vector3(x,y,0); } void LevelStart() { for (int i = 0; i < 5; i++) { pos = ran; mine = Instantiate(mine, pos,Quaternion.identity) as GameObject; mines.Add(mines); } foreach (GameObject m in mines) { m.transform.parent = this.transform; } } }