changeset 297:d1206b11ae2d

creating final video
author Robert McIntyre <rlm@mit.edu>
date Thu, 16 Feb 2012 12:48:51 -0700
parents 1eed471e2ebf
children 85f3ff3e3f26
files assets/Models/test-creature/hand.blend org/integration.org org/util.org
diffstat 3 files changed, 64 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/test-creature/hand.blend has changed
     2.1 --- a/org/integration.org	Thu Feb 16 11:04:22 2012 -0700
     2.2 +++ b/org/integration.org	Thu Feb 16 12:48:51 2012 -0700
     2.3 @@ -31,6 +31,19 @@
     2.4  
     2.5  (def output-base (File. "/home/r/proj/cortex/render/hand"))
     2.6  
     2.7 +
     2.8 +;; Let the hand fall palm-up
     2.9 +
    2.10 +;; it curls its phalanges, starting with the pinky.
    2.11 +
    2.12 +;; it lets these fall back down?
    2.13 +
    2.14 +;; block falls down onto the hand, accompanied by a sound. The block
    2.15 +;; can be seen by the hand's eye.
    2.16 +
    2.17 +;; hand FORCEFULLY catapults the  block so that it hits the camera.
    2.18 +
    2.19 +
    2.20  (defn motor-control-program
    2.21    "Create a function which will execute the motor script"
    2.22    [muscle-positions
    2.23 @@ -83,20 +96,55 @@
    2.24  (def full 9001)
    2.25  ;; the systax here is [keyframe body-part force]
    2.26  (def wiggle-each-finger-tip
    2.27 -  [[200 :pointer-3-f full]
    2.28 -   [200 :pointer-3-f 40]
    2.29 +  [[300 :pointer-3-f 50]
    2.30 +
    2.31  
    2.32     [400 :middle-3-f full]
    2.33 -   [401 :middle-3-f 40]
    2.34 +   [401 :middle-3-f 50]
    2.35  
    2.36     [600 :ring-3-f full]
    2.37     [601 :ring-3-f 40]
    2.38  
    2.39     [800 :pinky-3-f full]
    2.40 -   [801 :pinky-3-f 40]])
    2.41 +   [801 :pinky-3-f 50]
    2.42  
    2.43 +   [1300 :pointer-1-f full]
    2.44 +   [1300 :pointer-2-f full]
    2.45 +   [1300 :pointer-3-f 0]
    2.46  
    2.47 +   [1289 :middle-1-f full]
    2.48 +   [1289 :middle-2-f full]
    2.49 +   [1289 :middle-3-f 0]
    2.50 +   
    2.51 +   [1310 :pointer-1-f 0]
    2.52 +   [1310 :pointer-2-f 0]
    2.53 +   [1310 :pointer-3-f 0]
    2.54  
    2.55 +   [1310 :middle-1-f 0]
    2.56 +   [1310 :middle-2-f 0]
    2.57 +   [1310 :middle-3-f 0]
    2.58 +
    2.59 +   
    2.60 +
    2.61 +   ])
    2.62 +
    2.63 +(defn gen-summon-ball []
    2.64 +  (let [wait (atom 20)]
    2.65 +    (fn [world]
    2.66 +      (if (= 0 (swap! wait dec))
    2.67 +        (let [brick
    2.68 +              (box 0.8 0.8 0.8 :mass 0.05
    2.69 +                                :position (Vector3f. 0 0 0.5)
    2.70 +                                :color (ColorRGBA/Red))]
    2.71 +
    2.72 +          (.addControl
    2.73 +           brick
    2.74 +           (proxy [AbstractControl] []
    2.75 +             (controlUpdate [tpf]
    2.76 +               (println-repl (.getWorldTranslation brick)))
    2.77 +             (controlRender [_ _])))
    2.78 +          (add-element world brick))))))
    2.79 +          
    2.80  
    2.81  (def control-list
    2.82   [
    2.83 @@ -141,7 +189,8 @@
    2.84                           "Sounds/pure.wav" false)
    2.85          creature (doto (load-blender-model hand) 
    2.86                     (body!))
    2.87 -        
    2.88 +
    2.89 +        summon-ball (gen-summon-ball)
    2.90          ;;;;;;;;;;;;  Sensors/Effectors  ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
    2.91          ;;touch (touch! creature)
    2.92          ;;touch-display (view-touch)
    2.93 @@ -175,6 +224,9 @@
    2.94  
    2.95       (fn [world]
    2.96         (.setTimer world (RatchetTimer. 60))
    2.97 +       (position-camera
    2.98 +        world (Vector3f. 7.7101235, 6.3628435, -14.15047)
    2.99 +        (Quaternion. 0.3644328, -0.2558489, 0.104854375, 0.8892332))
   2.100         (light-up-everything world)
   2.101         (enable-debug world)
   2.102         (add-camera! world
   2.103 @@ -182,13 +234,14 @@
   2.104                                (.getChild 
   2.105                                 (.getChild creature "eyes") "eye"))
   2.106                      (comp (view-image) BufferedImage!))
   2.107 -       (speed-up world))
   2.108 +       (speed-up world)
   2.109 +       )
   2.110       (fn [world tpf]
   2.111         ;;(prop-display (prop))
   2.112         ;;(touch-display (map #(% (.getRootNode world)) touch))
   2.113         ;;(vision-display (map #(% world) vision))
   2.114         ;;(hearing-display (map #(% world) hearing))
   2.115 -
   2.116 +       (summon-ball world)
   2.117         ;;(muscle-display
   2.118         (control-script muscles)
   2.119         ;;)
     3.1 --- a/org/util.org	Thu Feb 16 11:04:22 2012 -0700
     3.2 +++ b/org/util.org	Thu Feb 16 12:48:51 2012 -0700
     3.3 @@ -113,13 +113,10 @@
     3.4  
     3.5  (defn position-camera
     3.6    "Change the position of the in-world camera."
     3.7 -  ([world position direction up]
     3.8 +  [world #^Vector3f position #^Quaternion rotation]
     3.9       (doto (.getCamera world)
    3.10 -       (.setLocation )
    3.11 -       (.lookAt direction up)))
    3.12 -  ([world position direction]
    3.13 -     (position-camera
    3.14 -      world position direction Vector3f/UNIT_Y)))
    3.15 +       (.setLocation position)
    3.16 +       (.setRotation rotation)))
    3.17  
    3.18  (defn enable-debug 
    3.19    "Turn on debug wireframes for every object in this simulation."
    3.20 @@ -219,7 +216,7 @@
    3.21  #+end_src
    3.22  
    3.23  #+results: util
    3.24 -: #'cortex.util/apply-map
    3.25 +: #'cortex.util/runonce
    3.26      
    3.27  
    3.28  *** Creating Basic Shapes