comparison org/integration.org @ 199:305439cec54d

added video to sense.org
author Robert McIntyre <rlm@mit.edu>
date Mon, 06 Feb 2012 01:40:22 -0700
parents deac7b708750
children 7351c9c0c471
comparison
equal deleted inserted replaced
198:fc0bf33bded2 199:305439cec54d
302 (Vector3f. -1 0 0)))) 302 (Vector3f. -1 0 0))))
303 (if @roll-right? 303 (if @roll-right?
304 (.applyTorque control 304 (.applyTorque control
305 (.mult (.getPhysicsRotation control) 305 (.mult (.getPhysicsRotation control)
306 (Vector3f. 1 0 0)))))))) 306 (Vector3f. 1 0 0))))))))
307
308 (defn follow-test
309 "Show a camera that stays in the same relative position to a blue cube."
310 []
311 (let [camera-pos (Vector3f. 0 30 0)
312 rock (box 1 1 1 :color ColorRGBA/Blue
313 :position (Vector3f. 0 10 0)
314 :mass 30
315 )
316 rot (.getWorldRotation rock)
317
318 table (box 3 1 10 :color ColorRGBA/Gray :mass 0
319 :position (Vector3f. 0 -3 0))]
320
321 (world
322 (nodify [rock table])
323 standard-debug-controls
324 (fn [world]
325 (let
326 [cam (doto (.clone (.getCamera world))
327 (.setLocation camera-pos)
328 (.lookAt Vector3f/ZERO
329 Vector3f/UNIT_X))]
330 (bind-sense rock cam)
331
332 (.setTimer world (RatchetTimer. 60))
333 (add-camera! world cam (comp (view-image) BufferedImage!))
334 (add-camera! world (.getCamera world) no-op))
335 )
336 (fn [_ _] (println-repl rot)))))
337 #+end_src 307 #+end_src
338 308
339 309
340 * COMMENT generate source 310 * COMMENT generate source
341 #+begin_src clojure :tangle ../src/cortex/integration.clj 311 #+begin_src clojure :tangle ../src/cortex/integration.clj