Moon.js 674 B

12345678910111213141516171819202122232425
  1. const Vector3 = require("./Vector3");
  2. module.exports = class Moon {
  3. /**
  4. * @param {Vector3} position The starting position of the moon
  5. */
  6. constructor(position) {
  7. /**
  8. * The position of the moon in space
  9. */
  10. this.position = position;
  11. /**
  12. * The position of the moon at the time of creation
  13. *
  14. * This is a silly trick to get a clean copy of the Vector, but it works.
  15. *
  16. * @private
  17. */
  18. this._initialPosition = position.negate().negate();
  19. /**
  20. * The current velocity of the moon
  21. */
  22. this.velocity = new Vector3(0, 0, 0);
  23. }
  24. };