ソースを参照

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
          */