diff org/body.org @ 139:ffbab4199c0d

going to de-macroify debug code
author Robert McIntyre <rlm@mit.edu>
date Thu, 02 Feb 2012 00:57:18 -0700
parents 16bdf9e80daf
children 22444eb20ecc
line wrap: on
line diff
     1.1 --- a/org/body.org	Thu Feb 02 00:05:17 2012 -0700
     1.2 +++ b/org/body.org	Thu Feb 02 00:57:18 2012 -0700
     1.3 @@ -384,7 +384,6 @@
     1.4          world-loop* `(fn [world# tpf#]
     1.5                         (~world-loop world# tpf#)
     1.6                         ~@splice-loop)]
     1.7 -        
     1.8    `(let [~move-up? (atom false)
     1.9           ~move-down? (atom false)
    1.10           ~move-left? (atom false)
    1.11 @@ -407,7 +406,7 @@
    1.12     and counterclockwise, and only affect roll."
    1.13    []
    1.14    (let [hand    (box 1 0.2 0.2 :position (Vector3f. 0 2 0)
    1.15 -                     :mass 0 :color ColorRGBA/Green :name "hand")
    1.16 +                     :mass 1 :color ColorRGBA/Green :name "hand")
    1.17          finger (box 1 0.2 0.2 :position (Vector3f. 2.4 2 0)
    1.18                      :mass 1 :color ColorRGBA/Red :name "finger")
    1.19          joint-node (box 0.1 0.05 0.05 :color ColorRGBA/Yellow
    1.20 @@ -422,24 +421,48 @@
    1.21          
    1.22          root (nodify [creature floor])
    1.23          prop (joint-proprioception creature joint-node)
    1.24 -        prop-view (proprioception-debug-window)]
    1.25 +        prop-view (proprioception-debug-window)
    1.26 +        finger-control (.getControl finger RigidBodyControl)
    1.27 +        hand-control (.getControl hand RigidBodyControl)
    1.28 +        
    1.29 +        controls
    1.30 +        (merge standard-debug-controls
    1.31 +               {"key-y"
    1.32 +                (fn [_ _] (.setEnabled finger-control true))
    1.33 +                "key-u"
    1.34 +                (fn [_ _] (.setEnabled finger-control false))
    1.35 +                "key-i"
    1.36 +                (fn [_ _] (.setEnabled hand-control true))
    1.37 +                "key-o"
    1.38 +                (fn [_ _] (.setEnabled hand-control false))
    1.39 +                "key-q"
    1.40 +                (fn [world _] (set-gravity world (Vector3f. 0 0 0)))
    1.41 +                }
    1.42 +               )
    1.43  
    1.44 -    (.setCollisionGroup
    1.45 -     (.getControl hand RigidBodyControl)
    1.46 -     PhysicsCollisionObject/COLLISION_GROUP_NONE)
    1.47 -
    1.48 +        ]
    1.49 +    (comment
    1.50 +      (.setCollisionGroup
    1.51 +       (.getControl hand RigidBodyControl)
    1.52 +       PhysicsCollisionObject/COLLISION_GROUP_NONE)
    1.53 +      )
    1.54 +    
    1.55      (with-movement
    1.56 -      finger
    1.57 -      ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"]
    1.58 +      hand
    1.59 +      ["key-w" "key-e" "key-s" "key-d" "key-x" "key-c"]
    1.60        [10 10 10 10 1 1]
    1.61 -      (world
    1.62 -       root
    1.63 -       standard-debug-controls
    1.64 -       (fn [world]
    1.65 +      (with-movement
    1.66 +        finger
    1.67 +        ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"]
    1.68 +        [10 10 10 10 1 1]
    1.69 +        (world
    1.70 +         root
    1.71 +         controls
    1.72 +         (fn [world]
    1.73           (.setTimer world (com.aurellem.capture.RatchetTimer. 60))
    1.74           (set-gravity world (Vector3f. 0 0 0))
    1.75           (light-up-everything world))
    1.76 -       (fn [_ _] (prop-view (list (prop))))))))
    1.77 +         (fn [_ _] (prop-view (list (prop)))))))))
    1.78  
    1.79  
    1.80