comparison org/body.org @ 139:ffbab4199c0d

going to de-macroify debug code
author Robert McIntyre <rlm@mit.edu>
date Thu, 02 Feb 2012 00:57:18 -0700
parents 16bdf9e80daf
children 22444eb20ecc
comparison
equal deleted inserted replaced
138:16bdf9e80daf 139:ffbab4199c0d
382 symbols directions forces) 382 symbols directions forces)
383 383
384 world-loop* `(fn [world# tpf#] 384 world-loop* `(fn [world# tpf#]
385 (~world-loop world# tpf#) 385 (~world-loop world# tpf#)
386 ~@splice-loop)] 386 ~@splice-loop)]
387
388 `(let [~move-up? (atom false) 387 `(let [~move-up? (atom false)
389 ~move-down? (atom false) 388 ~move-down? (atom false)
390 ~move-left? (atom false) 389 ~move-left? (atom false)
391 ~move-right? (atom false) 390 ~move-right? (atom false)
392 ~roll-left? (atom false) 391 ~roll-left? (atom false)
405 change only the value of pitch. key-f/key-g moves it side to side 404 change only the value of pitch. key-f/key-g moves it side to side
406 and changes yaw. key-v/key-b will spin the blue segment clockwise 405 and changes yaw. key-v/key-b will spin the blue segment clockwise
407 and counterclockwise, and only affect roll." 406 and counterclockwise, and only affect roll."
408 [] 407 []
409 (let [hand (box 1 0.2 0.2 :position (Vector3f. 0 2 0) 408 (let [hand (box 1 0.2 0.2 :position (Vector3f. 0 2 0)
410 :mass 0 :color ColorRGBA/Green :name "hand") 409 :mass 1 :color ColorRGBA/Green :name "hand")
411 finger (box 1 0.2 0.2 :position (Vector3f. 2.4 2 0) 410 finger (box 1 0.2 0.2 :position (Vector3f. 2.4 2 0)
412 :mass 1 :color ColorRGBA/Red :name "finger") 411 :mass 1 :color ColorRGBA/Red :name "finger")
413 joint-node (box 0.1 0.05 0.05 :color ColorRGBA/Yellow 412 joint-node (box 0.1 0.05 0.05 :color ColorRGBA/Yellow
414 :position (Vector3f. 1.2 2 0) 413 :position (Vector3f. 1.2 2 0)
415 :physical? false) 414 :physical? false)
420 floor (box 10 10 10 :position (Vector3f. 0 -15 0) 419 floor (box 10 10 10 :position (Vector3f. 0 -15 0)
421 :mass 0 :color ColorRGBA/Gray) 420 :mass 0 :color ColorRGBA/Gray)
422 421
423 root (nodify [creature floor]) 422 root (nodify [creature floor])
424 prop (joint-proprioception creature joint-node) 423 prop (joint-proprioception creature joint-node)
425 prop-view (proprioception-debug-window)] 424 prop-view (proprioception-debug-window)
426 425 finger-control (.getControl finger RigidBodyControl)
427 (.setCollisionGroup 426 hand-control (.getControl hand RigidBodyControl)
428 (.getControl hand RigidBodyControl) 427
429 PhysicsCollisionObject/COLLISION_GROUP_NONE) 428 controls
430 429 (merge standard-debug-controls
430 {"key-y"
431 (fn [_ _] (.setEnabled finger-control true))
432 "key-u"
433 (fn [_ _] (.setEnabled finger-control false))
434 "key-i"
435 (fn [_ _] (.setEnabled hand-control true))
436 "key-o"
437 (fn [_ _] (.setEnabled hand-control false))
438 "key-q"
439 (fn [world _] (set-gravity world (Vector3f. 0 0 0)))
440 }
441 )
442
443 ]
444 (comment
445 (.setCollisionGroup
446 (.getControl hand RigidBodyControl)
447 PhysicsCollisionObject/COLLISION_GROUP_NONE)
448 )
449
431 (with-movement 450 (with-movement
432 finger 451 hand
433 ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"] 452 ["key-w" "key-e" "key-s" "key-d" "key-x" "key-c"]
434 [10 10 10 10 1 1] 453 [10 10 10 10 1 1]
435 (world 454 (with-movement
436 root 455 finger
437 standard-debug-controls 456 ["key-r" "key-t" "key-f" "key-g" "key-v" "key-b"]
438 (fn [world] 457 [10 10 10 10 1 1]
458 (world
459 root
460 controls
461 (fn [world]
439 (.setTimer world (com.aurellem.capture.RatchetTimer. 60)) 462 (.setTimer world (com.aurellem.capture.RatchetTimer. 60))
440 (set-gravity world (Vector3f. 0 0 0)) 463 (set-gravity world (Vector3f. 0 0 0))
441 (light-up-everything world)) 464 (light-up-everything world))
442 (fn [_ _] (prop-view (list (prop)))))))) 465 (fn [_ _] (prop-view (list (prop)))))))))
443 466
444 467
445 468
446 469
447 #+end_src 470 #+end_src