changeset 82:6b4ca076285e

making some progress on cone joints...
author Robert McIntyre <rlm@mit.edu>
date Fri, 06 Jan 2012 02:03:43 -0700
parents 10f495560c59
children 14b604e955ed
files assets/Models/creature1/one.blend org/test-creature.org
diffstat 2 files changed, 26 insertions(+), 41 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/creature1/one.blend has changed
     2.1 --- a/org/test-creature.org	Thu Jan 05 21:31:34 2012 -0700
     2.2 +++ b/org/test-creature.org	Fri Jan 06 02:03:43 2012 -0700
     2.3 @@ -173,19 +173,19 @@
     2.4                        twist    (:twist constraints)]
     2.5                    
     2.6                    (println-repl "creating CONE joint")
     2.7 -                  (let [vector-1
     2.8 -                        (.mult (.getWorldRotation joint)
     2.9 -                               Vector3f/UNIT_X)
    2.10 -                        vector-2
    2.11 -                        (.normalize
    2.12 -                         (.subtract
    2.13 -                          (.getWorldTranslation joint)
    2.14 -                          (.getWorldTranslation obj-a)))
    2.15 +                  (let [frame-a
    2.16 +                        (.toRotationMatrix
    2.17 +                         (doto (Quaternion.)
    2.18 +                           (.fromAngleAxis
    2.19 +                            (float
    2.20 +                             (.angleBetween
    2.21 +                              pivot-a Vector3f/UNIT_X))
    2.22 +                            (.cross (.normalize pivot-a)
    2.23 +                                    Vector3f/UNIT_X))))
    2.24                          ]
    2.25                      (println-repl
    2.26 -                     "vector-1 :" vector-1)
    2.27 -                    (println-repl
    2.28 -                     "vector-2 :" vector-2)
    2.29 +                     "angle between pivot-a (" pivot-a ") and UNIT_X is"
    2.30 +                     (.angleBetween Vector3f/UNIT_X (.normalize pivot-a)))
    2.31                      
    2.32                      
    2.33                      
    2.34 @@ -195,40 +195,25 @@
    2.35                           control-b
    2.36                           pivot-a
    2.37                           pivot-b
    2.38 +
    2.39 +                        
    2.40 +                         ;; ;; frame-in-A
    2.41 +                         frame-a
    2.42 +                         frame-a
    2.43                           
    2.44 -                         ;;(doto (Matrix3f.)
    2.45 -                         ;;  (.fromStartEndVectors
    2.46 -                         ;;   Vector3f/UNIT_X
    2.47 -                         ;;   (.normalize
    2.48 -                         ;;    (.subtract
    2.49 -                         ;;     (.getWorldTranslation joint)
    2.50 -                         ;;     (.getWorldTranslation obj-a)))))
    2.51 -
    2.52 -
    2.53 -                         (.toRotationMatrix
    2.54 -                          (.getWorldRotation joint))
    2.55 +                         ;; (.toRotationMatrix
    2.56 +                         ;;  (doto (Quaternion.)
    2.57 +                         ;;    (.fromAngles
    2.58 +                         ;;     0 0 (* -1 (/ Math/PI 2)))))
    2.59  
    2.60                           
    2.61 -                         
    2.62 -                         (.toRotationMatrix
    2.63 -                          (.fromAngleAxis
    2.64 -                           (Quaternion.)
    2.65 -                           (.angleBetween Vector3f/UNIT_X pivot-a)
    2.66 -                           (.cross Vector3f/UNIT_X pivot-a)))
    2.67 -                         
    2.68 +                         ;; ;; frame-in-B
    2.69 +                         ;; (.toRotationMatrix
    2.70 +                         ;;  (doto (Quaternion.)
    2.71 +                         ;;    (.fromAngles
    2.72 +                         ;;     0 0 (* -1.2 (/ Math/PI 2)))))
    2.73  
    2.74 -                         
    2.75 -                         
    2.76 -                         ;; (doto (Matrix3f.)
    2.77 -                         ;;   (.fromStartEndVectors
    2.78 -                         ;;    Vector3f/UNIT_X
    2.79 -                         ;;    (.normalize
    2.80 -                         ;;     vector-1)))
    2.81 -                         
    2.82 -                         ;; (doto (Matrix3f.)
    2.83 -                         ;;   (.fromStartEndVectors
    2.84 -                         ;;    Vector3f/UNIT_X
    2.85 -                         ;;    vector-2))
    2.86 +
    2.87                           )
    2.88                        (.setLimit (float limit-xz)
    2.89                                   (float limit-xy)