Mercurial > cortex
changeset 138:16bdf9e80daf
working movement debug framework
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 02 Feb 2012 00:05:17 -0700 |
parents | 39c89ae5c7d0 |
children | ffbab4199c0d |
files | org/body.org |
diffstat | 1 files changed, 12 insertions(+), 50 deletions(-) [+] |
line wrap: on
line diff
1.1 --- a/org/body.org Wed Feb 01 23:46:31 2012 -0700 1.2 +++ b/org/body.org Thu Feb 02 00:05:17 2012 -0700 1.3 @@ -358,7 +358,7 @@ 1.4 (fn [state keymap key] 1.5 `(merge ~keymap 1.6 {~key 1.7 - (fn [_ pressed?#] 1.8 + (fn [_# pressed?#] 1.9 (reset! ~state pressed?#))})) 1.10 move-left? (gensym "move-left?") 1.11 move-right? (gensym "move-right?") 1.12 @@ -366,13 +366,7 @@ 1.13 move-down? (gensym "move-down?") 1.14 roll-left? (gensym "roll-left?") 1.15 roll-right? (gensym "roll-right?") 1.16 - directions 1.17 - [(Vector3f. 0 1 0) 1.18 - (Vector3f. 0 -1 0) 1.19 - (Vector3f. 0 0 1) 1.20 - (Vector3f. 0 0 -1) 1.21 - (Vector3f. -1 0 0) 1.22 - (Vector3f. 1 0 0)] 1.23 + directions [[0 1 0][0 -1 0][0 0 1][0 0 -1][-1 0 0][1 0 0]] 1.24 symbols [move-left? move-right? move-up? move-down? 1.25 roll-left? roll-right?] 1.26 1.27 @@ -380,9 +374,11 @@ 1.28 symbols 1.29 keyboard)) 1.30 1.31 - splice-loop (map (fn [sym force direction] 1.32 + splice-loop (map (fn [sym direction force] 1.33 `(if (deref ~sym) 1.34 - (tap ~object ~direction ~force))) 1.35 + (tap ~object 1.36 + (Vector3f. ~@direction) 1.37 + ~force))) 1.38 symbols directions forces) 1.39 1.40 world-loop* `(fn [world# tpf#] 1.41 @@ -399,8 +395,7 @@ 1.42 ~root-node 1.43 (reduce merge ~keymap*) 1.44 ~intilization 1.45 - ~world-loop*) 1.46 - ))) 1.47 + ~world-loop*)))) 1.48 1.49 1.50 (defn test-proprioception 1.51 @@ -425,19 +420,9 @@ 1.52 floor (box 10 10 10 :position (Vector3f. 0 -15 0) 1.53 :mass 0 :color ColorRGBA/Gray) 1.54 1.55 - move-up? (atom false) 1.56 - move-down? (atom false) 1.57 - move-left? (atom false) 1.58 - move-right? (atom false) 1.59 - roll-left? (atom false) 1.60 - roll-right? (atom false) 1.61 - 1.62 - 1.63 root (nodify [creature floor]) 1.64 prop (joint-proprioception creature joint-node) 1.65 prop-view (proprioception-debug-window)] 1.66 - 1.67 - 1.68 1.69 (.setCollisionGroup 1.70 (.getControl hand RigidBodyControl) 1.71 @@ -449,38 +434,15 @@ 1.72 [10 10 10 10 1 1] 1.73 (world 1.74 root 1.75 - (merge standard-debug-controls 1.76 - {"key-r" (fn [_ pressed?] (reset! move-up? pressed?)) 1.77 - "key-t" (fn [_ pressed?] (reset! move-down? pressed?)) 1.78 - "key-f" (fn [_ pressed?] (reset! move-left? pressed?)) 1.79 - "key-g" (fn [_ pressed?] (reset! move-right? pressed?)) 1.80 - "key-v" (fn [_ pressed?] (reset! roll-left? pressed?)) 1.81 - "key-b" (fn [_ pressed?] (reset! roll-right? pressed?))}) 1.82 + standard-debug-controls 1.83 (fn [world] 1.84 (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) 1.85 (set-gravity world (Vector3f. 0 0 0)) 1.86 (light-up-everything world)) 1.87 - (fn [_ _] 1.88 - (let [force 10 1.89 - left (Vector3f. 0 1 0) 1.90 - right (Vector3f. 0 -1 0) 1.91 - up (Vector3f. 0 0 1) 1.92 - down (Vector3f. 0 0 -1) 1.93 - roll-left (Vector3f. -1 0 0) 1.94 - roll-right (Vector3f. 1 0 0)] 1.95 - (if @move-up? (tap finger up force)) 1.96 - 1.97 - (if @move-down? (tap finger down force)) 1.98 - 1.99 - (if @move-left? (tap finger left force)) 1.100 - 1.101 - (if @move-right? (tap finger right force)) 1.102 - 1.103 - (if @roll-left? (tap finger roll-left (/ force 10))) 1.104 - 1.105 - (if @roll-right? (tap finger roll-right (/ force 10)))) 1.106 - 1.107 - (prop-view (list (prop)))))))) 1.108 + (fn [_ _] (prop-view (list (prop)))))))) 1.109 + 1.110 + 1.111 + 1.112 1.113 #+end_src 1.114