view org/body.org @ 49:96a41b384100

working on animations in jMonkeyEngine3
author Robert McIntyre <rlm@mit.edu>
date Sat, 12 Nov 2011 16:52:38 -0700
parents ee55966ce7f6
children b1b90c4ab0bf
line wrap: on
line source
1 #+title: The BODY!!!
2 #+author: Robert McIntyre
3 #+email: rlm@mit.edu
4 #+description: Simulating a body (movement, touch, propioception) in jMonkeyEngine3.
5 #+SETUPFILE: ../../aurellem/org/setup.org
6 #+INCLUDE: ../../aurellem/org/level-0.org
8 * Body
10 #+srcname: body-main
11 #+begin_src clojure
12 (ns cortex.body
13 (use (cortex world util import)))
15 (use 'clojure.contrib.def)
16 (cortex.import/mega-import-jme3)
17 (rlm.rlm-commands/help)
19 ;;(.loadModel
20 ;; (doto (asset-manager)
21 ;; (.registerLoader BlenderModelLoader (into-array String ["blend"])))
22 ;; "Models/person/person.blend")
24 (defn view-model [^String model]
25 (view
26 (.loadModel
27 (doto (asset-manager)
28 (.registerLoader BlenderModelLoader (into-array String ["blend"])))
29 model)))
31 (defn load-blender-scene [^String model]
32 (.loadModel
33 (doto (asset-manager)
34 (.registerLoader BlenderLoader (into-array String ["blend"])))
35 model))
37 (defn load-blender-model
38 [^String model]
39 (.loadModel
40 (doto (asset-manager)
41 (.registerLoader BlenderModelLoader (into-array String ["blend"])))
42 model))
45 (defn worm
46 []
47 (.loadModel (asset-manager) "Models/anim/worm.mesh.xml"))
50 (defn worm
51 []
52 (.loadModel (asset-manager) "Models/Oto/Oto.mesh.xml"))
56 (defn test-worm-anim []
58 (let [the-worm (worm)
59 anim-control (.getControl (worm) AnimControl)
60 channel (doto (.createChannel anim-control)
61 (.addAllBones)
62 (.setLoopMode LoopMode/Loop))
64 play-anim
65 (fn [world pressed]
66 (if (not pressed)
67 (do
68 (println-repl "space is pressed")
69 (.setAnim channel "Walk"))))
71 ]
73 (.start
74 (world
75 (doto (Node.)
76 (.attachChild the-worm))
77 {"key-space" play-anim}
78 light-up-everything
79 no-op
80 )
83 )))
89 #+end_src
98 * COMMENT generate Source.
99 #+begin_src clojure :tangle ../src/cortex/body.clj
100 <<body-main>>
101 #+end_src