# HG changeset patch # User Robert McIntyre # Date 1319358440 25200 # Node ID 7d0c0282c3a75e848826a4edb70d29bbe62e8ac0 # Parent 522cf85fdb571cb28fac0f18271fc702af9b89e7 got positioning right, but there is still a problem diff -r 522cf85fdb57 -r 7d0c0282c3a7 org/skin.org --- a/org/skin.org Sun Oct 23 00:59:22 2011 -0700 +++ b/org/skin.org Sun Oct 23 01:27:20 2011 -0700 @@ -108,28 +108,26 @@ (defn get-ray-direction [geom tri] - (let [new (Vector3f.)] + (let [n+c (Vector3f.)] (.calculateNormal tri) - - (.localToWorld geom (.getNormal tri) new) - (.subtract new (get-ray-origin geom tri)) - - ;;Vector3f/UNIT_Y + (.calculateCenter tri) + (.localToWorld geom (.add (.getCenter tri) (.getNormal tri)) n+c) + (.subtract n+c (get-ray-origin geom tri)) )) (defn ray-origin-debug - [ray] + [ray color] (make-shape (assoc base-shape :shape (Sphere. 5 5 0.05) :name "arrow" - :color ColorRGBA/Orange + :color color :texture false :physical? false :position (.getOrigin ray)))) -(defn ray-debug [ray] +(defn ray-debug [ray color] (make-shape (assoc base-shape @@ -160,28 +158,25 @@ (defn collision-debug [node result] - (println-repl "contact point: " (.getContactPoint result)) - - ) (defn touch-percieve [limit geom node debug-node] (let [normals (normal-rays limit geom)] (.detachAllChildren debug-node) - - - (println-repl "---------") (doall (for [ray normals] (do (let [results (CollisionResults.)] - (.attachChild debug-node (ray-debug ray)) - (.attachChild debug-node (ray-origin-debug ray)) (.collideWith geom ray results) + (let [color (contact-color (.size results))] + + (.attachChild debug-node (ray-debug ray color)) + (.attachChild debug-node (ray-origin-debug ray color)) + ) - ;;(println-repl (.size results) "results for " ray) - ;;(doall (map (partial collision-debug node) results)) + (println-repl (.size results) "results for " ray) + (doall (map (partial collision-debug node) results)) (.size results) ))))))