changeset 85:00ab1f10266f

creatig cone joints for hand
author Robert McIntyre <rlm@mit.edu>
date Sat, 07 Jan 2012 01:32:15 -0700
parents 4f5e2c629e45
children 35f485a0c93f
files assets/Models/creature1/one.blend org/test-creature.org
diffstat 2 files changed, 26 insertions(+), 61 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/creature1/one.blend has changed
     2.1 --- a/org/test-creature.org	Sat Jan 07 01:10:14 2012 -0700
     2.2 +++ b/org/test-creature.org	Sat Jan 07 01:32:15 2012 -0700
     2.3 @@ -180,59 +180,29 @@
     2.4                (do
     2.5                  (let [limit-xz (:limit-xz constraints)
     2.6                        limit-xy (:limit-xy constraints)
     2.7 -                      twist    (:twist constraints)]
     2.8 +                      twist    (:twist constraints)
     2.9 +                      rotation (.toRotationMatrix (.getWorldRotation joint))]
    2.10                    
    2.11                    (println-repl "creating CONE joint")
    2.12 -                  (let [frame-a
    2.13 -                        (.toRotationMatrix
    2.14 -                         (doto (Quaternion.)
    2.15 -                           (.fromAngleAxis
    2.16 -                            (float
    2.17 -                             (.angleBetween
    2.18 -                              (.normalize pivot-a) Vector3f/UNIT_X))
    2.19 -                            (.normalize
    2.20 -                             (.cross pivot-a
    2.21 -                                     Vector3f/UNIT_X)))))
    2.22 -                         ]
    2.23 -                    (println-repl "pivot-a" pivot-a)
    2.24 -                    (println-repl
    2.25 -                     "angle between pivot-a and UNIT_X is"
    2.26 -                     (.angleBetween Vector3f/UNIT_X (.normalize pivot-a)))
    2.27 -                    (println-repl "frame-a:" frame-a)
    2.28 -                    (println-repl
    2.29 -                     "frame-a moves Vector3f/UNIT_X to"
    2.30 -                     (.mult frame-a Vector3f/UNIT_X ))
    2.31 -                    
    2.32 -                    
    2.33 -                    (doto
    2.34 -                        (ConeJoint.
    2.35 -                         control-a
    2.36 -                         control-b
    2.37 -                         pivot-a
    2.38 -                         pivot-b
    2.39 -
    2.40 -                        
    2.41 -                         ;; frame-in-A
    2.42 -                         ;;frame-a
    2.43 -                         ;;frame-a
    2.44 -                         
    2.45 -                         (.toRotationMatrix
    2.46 -                          (doto (Quaternion.)
    2.47 -                            (.fromAngles
    2.48 -                             0 0 (* -0.5 (/ Math/PI 2)))))
    2.49 -                         
    2.50 -                         
    2.51 -                         ;; frame-in-B
    2.52 -                         (.toRotationMatrix
    2.53 -                          (doto (Quaternion.)
    2.54 -                            (.fromAngles
    2.55 -                             0 0 (* -0.5 (/ Math/PI 2)))))
    2.56 -                         
    2.57 -
    2.58 -                         )
    2.59 -                      (.setLimit (float limit-xz)
    2.60 -                                 (float limit-xy)
    2.61 -                                 (float twist))))))
    2.62 +                  (println-repl rotation)
    2.63 +                  (println-repl
    2.64 +                   "UNIT_X --> " (.mult rotation (Vector3f. 1 0 0)))
    2.65 +                  (println-repl
    2.66 +                   "UNIT_Y --> " (.mult rotation (Vector3f. 0 1 0)))
    2.67 +                  (println-repl
    2.68 +                   "UNIT_Z --> " (.mult rotation (Vector3f. 0 0 1)))
    2.69 +                  (doto
    2.70 +                      (ConeJoint.
    2.71 +                       control-a
    2.72 +                       control-b
    2.73 +                       pivot-a
    2.74 +                       pivot-b
    2.75 +                       rotation
    2.76 +                       rotation
    2.77 +                       )
    2.78 +                    (.setLimit (float limit-xz)
    2.79 +                               (float limit-xy)
    2.80 +                               (float twist)))))
    2.81                true
    2.82                (println-repl
    2.83                 "joint-type" joint-type "not recognized")))
    2.84 @@ -321,16 +291,11 @@
    2.85            (doto (Quaternion.)
    2.86              (.fromAngleAxis
    2.87               (* 1 (/ Math/PI 4))
    2.88 -             (Vector3f. 0 0 1)))
    2.89 -          (.mult
    2.90 -           (doto (Quaternion.)
    2.91 -             (.fromAngleAxis
    2.92 -              (* 2 (/ Math/PI 4))
    2.93 -              (Vector3f. 0 1 0)))
    2.94 -           (doto (Quaternion.)
    2.95 -             (.fromAngleAxis
    2.96 -              (* 1 (/ Math/PI 2))
    2.97 -              (Vector3f. 0 0 1))))))
    2.98 +             (Vector3f. -1 0 0)))
    2.99 +          (doto (Quaternion.)
   2.100 +            (.fromAngleAxis
   2.101 +             (* 1 (/ Math/PI 2))
   2.102 +             (Vector3f. 0 0 1)))))
   2.103          top-position (.mult joint-rotation (Vector3f. 8 0 0))
   2.104          
   2.105          origin (doto