private Vector AccelerationTowards( Planet otherPlanet ) { var toOtherVector = otherPlanet.Position - this.Position; var distance = toOtherVector.Length; var accelerationSize = GravityConstant * otherPlanet.Mass / ( distance * distance ); return toOtherVector / distance * accelerationSize; }
public void AccelerateTowards( Planet otherPlanet ) { Velocity += AccelerationTowards( otherPlanet ); }