# HG changeset patch # User Robert McIntyre # Date 1328166317 25200 # Node ID 16bdf9e80daf9f859b8c49bae171148769ac5518 # Parent 39c89ae5c7d0197df2b3d95d1cf114222d4a8fcb working movement debug framework diff -r 39c89ae5c7d0 -r 16bdf9e80daf org/body.org --- a/org/body.org Wed Feb 01 23:46:31 2012 -0700 +++ b/org/body.org Thu Feb 02 00:05:17 2012 -0700 @@ -358,7 +358,7 @@ (fn [state keymap key] `(merge ~keymap {~key - (fn [_ pressed?#] + (fn [_# pressed?#] (reset! ~state pressed?#))})) move-left? (gensym "move-left?") move-right? (gensym "move-right?") @@ -366,13 +366,7 @@ move-down? (gensym "move-down?") roll-left? (gensym "roll-left?") roll-right? (gensym "roll-right?") - directions - [(Vector3f. 0 1 0) - (Vector3f. 0 -1 0) - (Vector3f. 0 0 1) - (Vector3f. 0 0 -1) - (Vector3f. -1 0 0) - (Vector3f. 1 0 0)] + directions [[0 1 0][0 -1 0][0 0 1][0 0 -1][-1 0 0][1 0 0]] symbols [move-left? move-right? move-up? move-down? roll-left? roll-right?] @@ -380,9 +374,11 @@ symbols keyboard)) - splice-loop (map (fn [sym force direction] + splice-loop (map (fn [sym direction force] `(if (deref ~sym) - (tap ~object ~direction ~force))) + (tap ~object + (Vector3f. ~@direction) + ~force))) symbols directions forces) world-loop* `(fn [world# tpf#] @@ -399,8 +395,7 @@ ~root-node (reduce merge ~keymap*) ~intilization - ~world-loop*) - ))) + ~world-loop*)))) (defn test-proprioception @@ -425,19 +420,9 @@ floor (box 10 10 10 :position (Vector3f. 0 -15 0) :mass 0 :color ColorRGBA/Gray) - move-up? (atom false) - move-down? (atom false) - move-left? (atom false) - move-right? (atom false) - roll-left? (atom false) - roll-right? (atom false) - - root (nodify [creature floor]) prop (joint-proprioception creature joint-node) prop-view (proprioception-debug-window)] - - (.setCollisionGroup (.getControl hand RigidBodyControl) @@ -449,38 +434,15 @@ [10 10 10 10 1 1] (world root - (merge standard-debug-controls - {"key-r" (fn [_ pressed?] (reset! move-up? pressed?)) - "key-t" (fn [_ pressed?] (reset! move-down? pressed?)) - "key-f" (fn [_ pressed?] (reset! move-left? pressed?)) - "key-g" (fn [_ pressed?] (reset! move-right? pressed?)) - "key-v" (fn [_ pressed?] (reset! roll-left? pressed?)) - "key-b" (fn [_ pressed?] (reset! roll-right? pressed?))}) + standard-debug-controls (fn [world] (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) (set-gravity world (Vector3f. 0 0 0)) (light-up-everything world)) - (fn [_ _] - (let [force 10 - left (Vector3f. 0 1 0) - right (Vector3f. 0 -1 0) - up (Vector3f. 0 0 1) - down (Vector3f. 0 0 -1) - roll-left (Vector3f. -1 0 0) - roll-right (Vector3f. 1 0 0)] - (if @move-up? (tap finger up force)) - - (if @move-down? (tap finger down force)) - - (if @move-left? (tap finger left force)) - - (if @move-right? (tap finger right force)) - - (if @roll-left? (tap finger roll-left (/ force 10))) - - (if @roll-right? (tap finger roll-right (/ force 10)))) - - (prop-view (list (prop)))))))) + (fn [_ _] (prop-view (list (prop)))))))) + + + #+end_src