Mercurial > cortex
diff org/test-creature.org @ 89:cd5151b5e7c3
starting automatic touch for blender models
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 07 Jan 2012 10:49:49 -0700 |
parents | 3e929630a25f |
children | 6d7c17c847a3 |
line wrap: on
line diff
1.1 --- a/org/test-creature.org Sat Jan 07 05:24:14 2012 -0700 1.2 +++ b/org/test-creature.org Sat Jan 07 10:49:49 2012 -0700 1.3 @@ -162,14 +162,12 @@ 1.4 hinge-axis) 1.5 (.setLimit limit-1 limit-2)))) 1.6 1.7 - 1.8 (defmethod joint-dispatch :cone 1.9 [constraints control-a control-b pivot-a pivot-b rotation] 1.10 (let [limit-xz (:limit-xz constraints) 1.11 limit-xy (:limit-xy constraints) 1.12 twist (:twist constraints)] 1.13 1.14 - 1.15 (println-repl "creating CONE joint") 1.16 (println-repl rotation) 1.17 (println-repl 1.18 @@ -190,17 +188,15 @@ 1.19 (float limit-xy) 1.20 (float twist))))) 1.21 1.22 - 1.23 - 1.24 (defn connect 1.25 "here are some examples: 1.26 {:type :point} 1.27 {:type :hinge :limit [0 (/ Math/PI 2)] :axis (Vector3f. 0 1 0)} 1.28 (:axis defaults to (Vector3f. 1 0 0) if not provided for hinge joints) 1.29 1.30 - {:type :cone :limit-xz 0] 1.31 - :limit-xy 0] 1.32 - :twist 0]} (use XZY rotation mode in blender!)" 1.33 + {:type :cone :limit-xz 0] 1.34 + :limit-xy 0] 1.35 + :twist 0]} (use XZY rotation mode in blender!)" 1.36 [#^Node obj-a #^Node obj-b #^Node joint] 1.37 (let [control-a (.getControl obj-a RigidBodyControl) 1.38 control-b (.getControl obj-b RigidBodyControl) 1.39 @@ -208,15 +204,16 @@ 1.40 joint-rotation (.toRotationMatrix (.getWorldRotation joint)) 1.41 pivot-a (world-to-local obj-a joint-center) 1.42 pivot-b (world-to-local obj-b joint-center)] 1.43 - ;; A side-effect of creating a joint registers 1.44 - ;; it with both physics objects which in turn 1.45 - ;; will register the joint with the physics system 1.46 - ;; when the simulation is started. 1.47 + 1.48 (if-let [constraints 1.49 (map-vals 1.50 eval 1.51 (read-string 1.52 (meta-data joint "joint")))] 1.53 + ;; A side-effect of creating a joint registers 1.54 + ;; it with both physics objects which in turn 1.55 + ;; will register the joint with the physics system 1.56 + ;; when the simulation is started. 1.57 (do 1.58 (println-repl "creating joint between" 1.59 (.getName obj-a) "and" (.getName obj-b)) 1.60 @@ -224,7 +221,6 @@ 1.61 control-a control-b 1.62 pivot-a pivot-b 1.63 joint-rotation)) 1.64 - 1.65 (println-repl "could not find joint meta-data!")))) 1.66 1.67 (defn assemble-creature [#^Node pieces joints] 1.68 @@ -353,8 +349,6 @@ 1.69 0))) 1.70 [origin top bottom table])) 1.71 1.72 - 1.73 - 1.74 (defn test-joint [joint] 1.75 (let [[origin top bottom floor] (world-setup joint) 1.76 control (.getControl top RigidBodyControl)