Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // If this planet is active...
- Vector2 a = _body.position.normalized;
- Vector2 b = (a + _body.velocity).normalized;
- float angle = Vector2.Angle (a, b);
- this._total_angle += angle * Time.deltaTime;
- if (this._total_angle >= 360) {
- // If this planet has made a revolution...
- ++this._revolutions;
- this._total_angle = 0;
- this.OnRevolution.Invoke (this);
- }
- If reached minimum velocity
- next time a minimum velocity is reached (maybe not the same minimum value) an orbit has occurred
- end if
- If reached maximum velocity
- next time a maximum velocity is reached (not the same maximum) an orbit has occurred
- end if
- a= (distance(sunP ,minP) + distance(sunP ,maxP))/2
Add Comment
Please, Sign In to add comment