# HG changeset patch # User Robert McIntyre # Date 1319394126 25200 # Node ID 0eb2eac5336183cd3d411ea078e304d2e39702f0 # Parent 22c6878a1bc0d4089548780d0356fba333a6a38e progress!! diff -r 22c6878a1bc0 -r 0eb2eac53361 org/skin.org --- a/org/skin.org Sun Oct 23 11:03:52 2011 -0700 +++ b/org/skin.org Sun Oct 23 11:22:06 2011 -0700 @@ -115,24 +115,34 @@ (println-repl "contact point: " (.getContactPoint result)) ) -(def init-node - (fn [debug-node rays] +(defn update-ray-debug [node ray] + (.setLocalTranslation (.getChild node 1) (.getOrigin ray))) + + +(defn init-node + [debug-node rays] + (println-repl "Init touch debug node.") (.detachAllChildren debug-node) - (for [ray rays] - (.attachChild debug-node (ray-debug ray ColorRGBA/Gray)) - (.attachChild debug-node (ray-origin-debug ray ColorRGBA/Gray)) + (dorun + (for [ray rays] + (do + (.attachChild + debug-node + (doto (Node.) + (.attachChild (ray-debug ray ColorRGBA/Gray)) + (.attachChild (ray-origin-debug ray ColorRGBA/Gray)))))))) - -(defn manage-ray-debug-node [debug-node ray color] - +(defn manage-ray-debug-node [debug-node geom touch-data limit] + (let [rays (normal-rays limit geom)] + (if (not= (count (.getChildren debug-node)) (count touch-data)) + (init-node debug-node rays)) + (dorun + (for [n (range (count touch-data))] + (update-ray-debug (.getChild debug-node n) (nth rays n)))))) - ) - - - -(defn touch-percieve [limit geom node debug-node] +(defn touch-percieve [limit geom node] (let [normals (normal-rays limit geom)] (doall @@ -241,9 +251,9 @@ ) (fn [& _] - (println-repl - (touch-percieve 0.2 b node debug-node) - ) + (let [touch-data (touch-percieve 0.2 b node)] + (println-repl touch-data) + (manage-ray-debug-node debug-node b touch-data 0.2)) (Thread/sleep 10) ;;(touch-print controls) ;;(color-touch controls)