Pārlūkot izejas kodu

Add initialPosition property to moons

ApisNecros 4 mēneši atpakaļ
vecāks
revīzija
b7ba9471a0
1 mainītis faili ar 8 papildinājumiem un 0 dzēšanām
  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
          */