diff org/body.org @ 321:702b5c78c2de

gathered all the tests into (run-suite), which should make testing vastly easier.
author Robert McIntyre <rlm@mit.edu>
date Tue, 08 May 2012 08:22:19 -0500
parents bb3f8a4af87f
children 4f5a5d5f1613
line wrap: on
line diff
     1.1 --- a/org/body.org	Thu Mar 01 06:24:17 2012 -0700
     1.2 +++ b/org/body.org	Tue May 08 08:22:19 2012 -0500
     1.3 @@ -135,8 +135,8 @@
     1.4                (.getMesh geom))
     1.5               (if-let [mass (meta-data geom "mass")]
     1.6                 (do
     1.7 -                 (println-repl
     1.8 -                  "setting" (.getName geom) "mass to" (float mass))
     1.9 +                 ;;(println-repl
    1.10 +                 ;; "setting" (.getName geom) "mass to" (float mass))
    1.11                   (float mass))
    1.12                 (float 1)))]
    1.13          (.addControl geom physics-control)))
    1.14 @@ -295,7 +295,7 @@
    1.15  
    1.16  (defmethod joint-dispatch :point
    1.17    [constraints control-a control-b pivot-a pivot-b rotation]
    1.18 -  (println-repl "creating POINT2POINT joint")
    1.19 +  ;;(println-repl "creating POINT2POINT joint")
    1.20    ;; bullet's point2point joints are BROKEN, so we must use the
    1.21    ;; generic 6DOF joint instead of an actual Point2Point joint!
    1.22  
    1.23 @@ -308,7 +308,7 @@
    1.24       pivot-b))
    1.25  
    1.26    ;; but instead we must do this:
    1.27 -  (println-repl "substituting 6DOF joint for POINT2POINT joint!")
    1.28 +  ;;(println-repl "substituting 6DOF joint for POINT2POINT joint!")
    1.29    (doto
    1.30        (SixDofJoint.
    1.31         control-a
    1.32 @@ -321,7 +321,7 @@
    1.33  
    1.34  (defmethod joint-dispatch :hinge
    1.35    [constraints control-a control-b pivot-a pivot-b rotation]
    1.36 -  (println-repl "creating HINGE joint")
    1.37 +  ;;(println-repl "creating HINGE joint")
    1.38    (let [axis
    1.39          (if-let
    1.40              [axis (:axis constraints)]
    1.41 @@ -348,14 +348,14 @@
    1.42          limit-xy (:limit-xy constraints)
    1.43          twist    (:twist constraints)]
    1.44      
    1.45 -    (println-repl "creating CONE joint")
    1.46 -    (println-repl rotation)
    1.47 -    (println-repl
    1.48 -     "UNIT_X --> " (.mult rotation (Vector3f. 1 0 0)))
    1.49 -    (println-repl
    1.50 -     "UNIT_Y --> " (.mult rotation (Vector3f. 0 1 0)))
    1.51 -    (println-repl
    1.52 -     "UNIT_Z --> " (.mult rotation (Vector3f. 0 0 1)))
    1.53 +    ;;(println-repl "creating CONE joint")
    1.54 +    ;;(println-repl rotation)
    1.55 +    ;;(println-repl
    1.56 +    ;; "UNIT_X --> " (.mult rotation (Vector3f. 1 0 0)))
    1.57 +    ;;(println-repl
    1.58 +    ;; "UNIT_Y --> " (.mult rotation (Vector3f. 0 1 0)))
    1.59 +    ;;(println-repl
    1.60 +    ;; "UNIT_Z --> " (.mult rotation (Vector3f. 0 0 1)))
    1.61      (doto
    1.62          (ConeJoint.
    1.63           control-a
    1.64 @@ -398,13 +398,14 @@
    1.65        ;; will register the joint with the physics system
    1.66        ;; when the simulation is started.
    1.67        (do
    1.68 -        (println-repl "creating joint between"
    1.69 -                      (.getName obj-a) "and" (.getName obj-b))
    1.70 +        ;;(println-repl "creating joint between"
    1.71 +        ;;              (.getName obj-a) "and" (.getName obj-b))
    1.72          (joint-dispatch constraints
    1.73                          control-a control-b
    1.74                          pivot-a pivot-b
    1.75                          joint-rotation))
    1.76 -      (println-repl "could not find joint meta-data!"))))
    1.77 +      ;;(println-repl "could not find joint meta-data!")
    1.78 +      )))
    1.79  #+end_src
    1.80  
    1.81  Creating joints is now a matter of applying =connect= to each joint
    1.82 @@ -507,6 +508,14 @@
    1.83              "Models/test-creature/worm.blend"))
    1.84  
    1.85  (defn test-worm
    1.86 +
    1.87 +  "Testing physical bodies: 
    1.88 +   You should see the the worm fall onto a table. You can fire
    1.89 +   physical balls at it and the worm should move upon being struck.
    1.90 +
    1.91 +   Keys:
    1.92 +     <space> : fire cannon ball."
    1.93 +
    1.94    ([] (test-worm false))
    1.95    ([record?]
    1.96       (let [timer (RatchetTimer. 60)]
    1.97 @@ -527,6 +536,9 @@
    1.98          no-op))))
    1.99  #+end_src
   1.100  
   1.101 +#+results: test-4
   1.102 +: #'cortex.test.body/test-worm
   1.103 +
   1.104  #+begin_html
   1.105  <div class="figure">
   1.106  <center>