private void CalcVelocity(Vector3 force) { acceleration = force / mass; //Acceleration in m/s^2 acceleration /= scaleManager.GetDistance(); //Acceleration in AU*s^-2 velocity += acceleration * Time.fixedDeltaTime * scaleManager.GetTime(); }
private void Start() { lastX = this.transform.position.x; float axisLength = (orbitAround.transform.position - this.transform.position).magnitude * scaleManager.GetDistance(); //Axis length in m //Equation: sqrt(G*M/r) localVelocity = Mathf.Sqrt(scaleManager.GetG() * orbitAround.GetComponent <Body>().GetMass() / axisLength) * velocityMultiplier; //Velocity in m/s //Debug.Log(localVelocity); localVelocity /= scaleManager.GetDistance(); //Velocity in AU/s velocity = localVelocity * transform.forward; }