comparison org/test-creature.org @ 148:511112c44b16

muscles are tested and work!
author Robert McIntyre <rlm@mit.edu>
date Fri, 03 Feb 2012 01:04:42 -0700
parents 72801a20b8e5
children 1e6beed24cec
comparison
equal deleted inserted replaced
147:72801a20b8e5 148:511112c44b16
1115 fiber-integral)))) 1115 fiber-integral))))
1116 fiber-integral)) 1116 fiber-integral))
1117 control (.getControl target RigidBodyControl)] 1117 control (.getControl target RigidBodyControl)]
1118 (fn [n] 1118 (fn [n]
1119 (let [pool-index (min n (count fibers))] 1119 (let [pool-index (min n (count fibers))]
1120 (.applyTorque control (force-index n)))))) 1120 (.applyTorque control (.mult axis (force-index n)))))))
1121 1121
1122 1122
1123 (defn enable-muscles 1123 (defn enable-muscles
1124 "Must be called on a creature after RigidBodyControls have been 1124 "Must be called on a creature after RigidBodyControls have been
1125 created." 1125 created."
1146 hearing-senses) 1146 hearing-senses)
1147 bell (AudioNode. (asset-manager) 1147 bell (AudioNode. (asset-manager)
1148 "Sounds/pure.wav" false) 1148 "Sounds/pure.wav" false)
1149 prop (proprioception creature) 1149 prop (proprioception creature)
1150 prop-debug (proprioception-debug-window) 1150 prop-debug (proprioception-debug-window)
1151
1152 muscle-fns (enable-muscles creature)
1151 ;; dream 1153 ;; dream
1152 1154
1153 ] 1155 ]
1154 1156
1155 1157
1171 {"key-return" 1173 {"key-return"
1172 (fn [_ value] 1174 (fn [_ value]
1173 (if value 1175 (if value
1174 (do 1176 (do
1175 (println-repl "play-sound") 1177 (println-repl "play-sound")
1176 (.play bell))))}) 1178 (.play bell))))
1179 "key-h"
1180 (fn [_ value]
1181 (if value
1182 (do
1183 (println-repl "muscle activating!")
1184 ((first muscle-fns) 199))))
1185
1186 })
1177 (fn [world] 1187 (fn [world]
1178 (light-up-everything world) 1188 (light-up-everything world)
1179 (enable-debug world) 1189 (enable-debug world)
1180 (dorun (map #(% world) init-vision-fns)) 1190 (dorun (map #(% world) init-vision-fns))
1181 (dorun (map #(% world) init-hearing-fns)) 1191 (dorun (map #(% world) init-hearing-fns))
1188 ;;(set-gravity world (Vector3f. 0 0 0)) 1198 ;;(set-gravity world (Vector3f. 0 0 0))
1189 ;;(com.aurellem.capture.Capture/captureVideo 1199 ;;(com.aurellem.capture.Capture/captureVideo
1190 ;; world (file-str "/home/r/proj/ai-videos/hand")) 1200 ;; world (file-str "/home/r/proj/ai-videos/hand"))
1191 ;;(.setTimer world (RatchetTimer. 60)) 1201 ;;(.setTimer world (RatchetTimer. 60))
1192 (speed-up world) 1202 (speed-up world)
1193 ;;(set-gravity world (Vector3f. 0 0 0)) 1203 (set-gravity world (Vector3f. 0 0 0))
1194 ) 1204 )
1195 (fn [world tpf] 1205 (fn [world tpf]
1196 ;;(dorun 1206 ;;(dorun
1197 ;; (map #(%1 %2) touch-nerves (repeat (.getRootNode world)))) 1207 ;; (map #(%1 %2) touch-nerves (repeat (.getRootNode world))))
1198 1208