# HG changeset patch # User Robert McIntyre # Date 1325958589 25200 # Node ID cd5151b5e7c3a18baf88f5313faef53897d83826 # Parent 3e929630a25ff14a83ccff12c3be6e9d04ee7ea0 starting automatic touch for blender models diff -r 3e929630a25f -r cd5151b5e7c3 assets/Models/creature1/end.png Binary file assets/Models/creature1/end.png has changed diff -r 3e929630a25f -r cd5151b5e7c3 assets/Models/creature1/one.blend Binary file assets/Models/creature1/one.blend has changed diff -r 3e929630a25f -r cd5151b5e7c3 assets/Models/creature1/touch.blend Binary file assets/Models/creature1/touch.blend has changed diff -r 3e929630a25f -r cd5151b5e7c3 assets/Models/creature1/try-again.blend Binary file assets/Models/creature1/try-again.blend has changed diff -r 3e929630a25f -r cd5151b5e7c3 org/test-creature.org --- a/org/test-creature.org Sat Jan 07 05:24:14 2012 -0700 +++ b/org/test-creature.org Sat Jan 07 10:49:49 2012 -0700 @@ -162,14 +162,12 @@ hinge-axis) (.setLimit limit-1 limit-2)))) - (defmethod joint-dispatch :cone [constraints control-a control-b pivot-a pivot-b rotation] (let [limit-xz (:limit-xz constraints) limit-xy (:limit-xy constraints) twist (:twist constraints)] - (println-repl "creating CONE joint") (println-repl rotation) (println-repl @@ -190,17 +188,15 @@ (float limit-xy) (float twist))))) - - (defn connect "here are some examples: {:type :point} {:type :hinge :limit [0 (/ Math/PI 2)] :axis (Vector3f. 0 1 0)} (:axis defaults to (Vector3f. 1 0 0) if not provided for hinge joints) - {:type :cone :limit-xz 0] - :limit-xy 0] - :twist 0]} (use XZY rotation mode in blender!)" + {:type :cone :limit-xz 0] + :limit-xy 0] + :twist 0]} (use XZY rotation mode in blender!)" [#^Node obj-a #^Node obj-b #^Node joint] (let [control-a (.getControl obj-a RigidBodyControl) control-b (.getControl obj-b RigidBodyControl) @@ -208,15 +204,16 @@ joint-rotation (.toRotationMatrix (.getWorldRotation joint)) pivot-a (world-to-local obj-a joint-center) pivot-b (world-to-local obj-b joint-center)] - ;; A side-effect of creating a joint registers - ;; it with both physics objects which in turn - ;; will register the joint with the physics system - ;; when the simulation is started. + (if-let [constraints (map-vals eval (read-string (meta-data joint "joint")))] + ;; A side-effect of creating a joint registers + ;; it with both physics objects which in turn + ;; will register the joint with the physics system + ;; when the simulation is started. (do (println-repl "creating joint between" (.getName obj-a) "and" (.getName obj-b)) @@ -224,7 +221,6 @@ control-a control-b pivot-a pivot-b joint-rotation)) - (println-repl "could not find joint meta-data!")))) (defn assemble-creature [#^Node pieces joints] @@ -353,8 +349,6 @@ 0))) [origin top bottom table])) - - (defn test-joint [joint] (let [[origin top bottom floor] (world-setup joint) control (.getControl top RigidBodyControl)