浏览代码

Add initialPosition property to moons

ApisNecros 4 月之前
父节点
当前提交
b7ba9471a0
共有 1 个文件被更改,包括 8 次插入0 次删除
  1. 8 0
      12/Moon.js

+ 8 - 0
12/Moon.js

@@ -9,6 +9,14 @@ module.exports = class Moon {
          * The position of the moon in space
          */
         this.position = position;
+        /**
+         * The position of the moon at the time of creation
+         *
+         * This is a silly trick to get a clean copy of the Vector, but it works.
+         *
+         * @private
+         */
+        this._initialPosition = position.negate().negate();
         /**
          * The current velocity of the moon
          */