view org/integration.org @ 76:5e75b616ca60

going to work on constraints for the joints in the hand.
author Robert McIntyre <rlm@mit.edu>
date Wed, 28 Dec 2011 23:12:32 -0700
parents 257a86328adb
children
line wrap: on
line source


3 * TODO goals for today
4 - [X] create falling cube in blender
5 - [ ] record falling cube animation in blender
6 - [ ] import falling cube in jMonkeyEngine
7 - [ ] record jmonkeyEngine cube animation
10 #+name: integration
11 #+begin_src clojure
12 (ns cortex.integration
13 "Enable loading creatures with senses from blender."
14 {:author "Robert McIntyre"})
16 ;; TODO remove this!
17 (require 'cortex.import)
18 (cortex.import/mega-import-jme3)
19 (use '(cortex world util))
21 (rlm.rlm-commands/help)
25 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
27 ;; this could be a good way to give objects special properties like
28 ;; being eyes and the like
29 (defn load-blender-model
30 "Load a .blend file using an asset folder relative path."
31 [^String model]
32 (.loadModel
33 (doto (asset-manager)
34 (.registerLoader BlenderModelLoader (into-array String ["blend"])))
35 model))
37 (defn scene []
38 (load-blender-model "Models/property/test.blend"))
40 (defn test-GET! []
41 (.getUserData
42 (.getChild
43 (scene) 0)
44 "properties"))
46 (defn make-eye []
47 (println "hi"))
49 (defn test-eval-prop []
50 (eval (read-string (.findValue (test-GET!) "form"))))
52 ;; the properties are saved along with the blender file.
53 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
57 ;; Sensors are thunk-functions that return sensory data.
58 ;; Effectors take data and cause changes in the results of the sensor
59 ;; functions.
61 (defrecord Creature [sensors effectors])
71 #+end_src
75 #+begin_src clojure :tangle ../src/cortex/integration.clj
76 <<integration>>
77 #+end_src