// Update is called once per frame public void CFixedUpdate() { transform.position = CVector3.toV3(CVector3.multiply(position, scale)); //Debug.Log(CVector3.distance(position, masses[i].position)); for (int i = 0; i < masses.Count; i++) { if (masses[i] != this) { velocity = CVector3.add( velocity , CVector3.multiply( CVector3.subtract(masses[i].position, position) , ((g * masses[i].mass) / Math.Pow(CVector3.distance(position, masses[i].position), 3)) * timeScale)); } } }
public void C3FixedUpdate() { float fscale = 0; transform.position = CVector3.toV3(position, scale, TrailPool.cameraScale, TrailPool.cameraX, TrailPool.cameraY, radius, out fscale); Vector3 oScale = new Vector3(fscale, 0, fscale); transform.localScale = oScale; if (CVector3.distance(lastPos, position) * scale * TrailPool.cameraScale > .3) { lastPos = position; //Debug.Log(CVector3.mag(velocity)); //Debug.Log(Time.timeScale); } else { return; } if (trailObjs.Count < trail) { Trail temp = TrailPool.Get(); temp.enabled = true; temp.position = position; temp.CFixedUpdate(); trailObjs.Enqueue(temp); } else if (trailObjs.Count > trail) { Trail temp = trailObjs.Dequeue(); temp.Disable(); TrailPool.AddToStack(temp); } else { Trail temp = trailObjs.Dequeue(); temp.enabled = true; temp.position = position; temp.CFixedUpdate(); trailObjs.Enqueue(temp); } }