 (defn rotate-direction [direction axis angle]
   (assoc direction axis (+ (direction axis) angle)))
 
-(defn translate-with-direction [position direction]
-  ;; Direction, measured in 3 angles.
-  ;; (0, 0, 0) is origin, upright, facing -z
-  (let [[angle-x angle-y angle-z] direction
-        distance 1.0
-        [px py pz] position
-        dx (* -1.0 distance (Math/sin angle-y))
-        dy 0.0
-        dz (* -1.0 distance (Math/cos angle-y))
-        new-x (+ px dx)
-        new-y (+ py dy)
-        new-z (+ pz dz)]
-    [new-x new-y new-z]))
+(defn translate-with-direction
+  ([position direction] (translate-with-direction position direction (float 1.0)))
+  ([position direction distance]
+     ;; Direction, measured in 3 angles.
+     ;; (0, 0, 0) is origin, upright, facing -z
+     (let [[angle-x angle-y angle-z] direction
+           [px py pz] position
+           dx (* -1.0 distance (Math/sin angle-y))
+           dy 0.0
+           dz (* -1.0 distance (Math/cos angle-y))
+           new-x (+ px dx)
+           new-y (+ py dy)
+           new-z (+ pz dz)]
+       [new-x new-y new-z])))
 
-(defn print-info []
-  (println "player-position:" @player-position
-           ", player-direction:" @player-direction
-           ", direction point:" (translate-with-direction @player-position @player-direction)))
+(defn print-player []
+  (when @show-player?
+    (println "player-position:" @player-position
+             ", player-direction:" @player-direction
+             ", direction point:" (translate-with-direction @player-position @player-direction))))
+
+(defn player-moved []
+  (print-player))
 
 (defn key-left-down []
   (swap! player-direction #(rotate-direction % 1 0.1))
-  (print-info))
+  (player-moved)
+  @player-direction)
 
 (defn key-right-down []
   (swap! player-direction #(rotate-direction % 1 -0.1))
-  (print-info))
+  (player-moved)
+  @player-direction)
 
 (def up-down-callbacks
   {:angle-speed {:atom angle-speed, :amount 0.1}})

   ;; Debugging keys
   {:key :up, :down? true, :repeat? false :callback key-up}
   {:key :down, :down? true, :repeat? false :callback key-down}
   {:key :1, :down? true, :repeat? false :callback (fn [] (set-mode :angle-speed))}
   {:key :2, :down? true, :repeat? false :callback (fn [] (set-mode :eye-z))}])

(defn register-listeners []

  (println "Mode:" m)
  (swap! mode (fn [_] identity m)))

(defn move [direction amount]
  (swap! player-position (fn [pp] (translate-with-direction pp direction amount)))
  (player-moved)
  @player-position)

(defn move-sideways [amount]
  (move (rotate-direction @player-direction 1 (* -0.5 Math/PI)) amount))

(defn move-forward [amount]
  (move @player-direction amount))

(def listeners
  [{:key :left, :down? true, :repeat? false :callback key-left-down}
