static void ComperMoonsZ(Moon moonA, Moon moonB) { //need three way logic here for ==s int vz = 0; vz = moonA.Postion.Z < moonB.Postion.Z ? 1 : -1; vz = moonA.Postion.Z == moonB.Postion.Z ? 0 : vz; Vector3 va = new Vector3(0, 0, vz); moonA.AddVelocity(va); Vector3 vb = new Vector3(0, 0, vz * -1); moonB.AddVelocity(vb); }
//Axises are indepent so we should split this out really //Just doing one for testing now static void ComperMoonsX(Moon moonA, Moon moonB) { //need three way logic here for ==s int vx = 0; vx = moonA.Postion.X < moonB.Postion.X ? 1 : -1; vx = moonA.Postion.X == moonB.Postion.X ? 0 : vx; Vector3 va = new Vector3(vx, 0, 0); moonA.AddVelocity(va); Vector3 vb = new Vector3(vx * -1, 0, 0); moonB.AddVelocity(vb); }
static void ComperMoonsY(Moon moonA, Moon moonB) { //need three way logic here for ==s int vy = 0; vy = moonA.Postion.Y < moonB.Postion.Y ? 1 : -1; vy = moonA.Postion.Y == moonB.Postion.Y ? 0 : vy; Vector3 va = new Vector3(0, vy, 0); moonA.AddVelocity(va); Vector3 vb = new Vector3(0, vy * -1, 0); moonB.AddVelocity(vb); }