changeset 12:22c6878a1bc0

going to great debug view of new raycasting touch
author Robert McIntyre <rlm@mit.edu>
date Sun, 23 Oct 2011 11:03:52 -0700
parents a149692d3d1f
children 0eb2eac53361
files org/skin.org
diffstat 1 files changed, 25 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
     1.1 --- a/org/skin.org	Sun Oct 23 10:48:41 2011 -0700
     1.2 +++ b/org/skin.org	Sun Oct 23 11:03:52 2011 -0700
     1.3 @@ -107,10 +107,7 @@
     1.4        (doto 
     1.5            (Ray. (get-ray-origin geom tri)
     1.6                  (get-ray-direction geom tri))
     1.7 -                
     1.8 -        (.setLimit limit)
     1.9 -        )
    1.10 -      )
    1.11 +        (.setLimit limit)))
    1.12      (triangles geom))))
    1.13  
    1.14  
    1.15 @@ -118,9 +115,26 @@
    1.16    (println-repl "contact point: " (.getContactPoint result))
    1.17    )
    1.18  
    1.19 +(def init-node
    1.20 +  (fn [debug-node rays]
    1.21 +    (.detachAllChildren debug-node)
    1.22 +    (for [ray rays]
    1.23 +    (.attachChild debug-node (ray-debug ray ColorRGBA/Gray))
    1.24 +    (.attachChild debug-node (ray-origin-debug ray ColorRGBA/Gray))
    1.25 +
    1.26 +    
    1.27 +
    1.28 +(defn manage-ray-debug-node [debug-node ray color]
    1.29 +  
    1.30 +
    1.31 +
    1.32 +  )
    1.33 +
    1.34 +
    1.35 +
    1.36  (defn touch-percieve [limit geom node debug-node]
    1.37    (let [normals  (normal-rays limit geom)]
    1.38 -    (.detachAllChildren debug-node)
    1.39 +
    1.40      (doall
    1.41       (for [ray normals]
    1.42         (do
    1.43 @@ -130,9 +144,7 @@
    1.44                   ;;color (contact-color answer)
    1.45                   ]
    1.46               ;;(dorun (map #(println-repl (.getName (.getGeometry %))) results))
    1.47 -             ;;(.attachChild debug-node (ray-debug ray color))
    1.48 -             ;;(.attachChild debug-node (ray-origin-debug ray color))
    1.49 -           
    1.50 +             
    1.51             
    1.52             ;;(println-repl (.size results) "results for " ray)
    1.53             ;;(doall (map (partial collision-debug node) results))
    1.54 @@ -210,11 +222,13 @@
    1.55  	;;(make-touch-sphere b)
    1.56  	;;(make-touch b)
    1.57          debug-node (Node.)
    1.58 -        node      (doto (Node.) (.attachChild b) (.attachChild f)
    1.59 -                        (.attachChild debug-node))]
    1.60 +        node      (doto (Node.) (.attachChild b) (.attachChild f))
    1.61 +        root-node (doto (Node.) (.attachChild node)
    1.62 +                        (.attachChild debug-node))
    1.63 +        ]
    1.64      
    1.65      (world
    1.66 -     node
    1.67 +     root-node
    1.68       {"key-return" (fire-cannon-ball)}
    1.69       ;;no-op
    1.70       (fn [world]