Guest User

Untitled

a guest
Dec 14th, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. // If this planet is active...
  2. Vector2 a = _body.position.normalized;
  3. Vector2 b = (a + _body.velocity).normalized;
  4.  
  5. float angle = Vector2.Angle (a, b);
  6. this._total_angle += angle * Time.deltaTime;
  7.  
  8. if (this._total_angle >= 360) {
  9. // If this planet has made a revolution...
  10. ++this._revolutions;
  11. this._total_angle = 0;
  12. this.OnRevolution.Invoke (this);
  13. }
  14.  
  15. If reached minimum velocity
  16. next time a minimum velocity is reached (maybe not the same minimum value) an orbit has occurred
  17. end if
  18.  
  19. If reached maximum velocity
  20. next time a maximum velocity is reached (not the same maximum) an orbit has occurred
  21. end if
  22.  
  23. a= (distance(sunP ,minP) + distance(sunP ,maxP))/2
Add Comment
Please, Sign In to add comment