# HG changeset patch # User Robert McIntyre # Date 1321341886 25200 # Node ID bb24106cbd6a5c8fe0200c46f1d69cf99ec1187e # Parent 00d0e1639d4bc9e12be69ae237f70950c0391745 many problems solved by tightening up the vertex groups in the blender model diff -r 00d0e1639d4b -r bb24106cbd6a assets/Models/anim2/worm3.blend Binary file assets/Models/anim2/worm3.blend has changed diff -r 00d0e1639d4b -r bb24106cbd6a org/body.org --- a/org/body.org Mon Nov 14 21:30:23 2011 -0700 +++ b/org/body.org Tue Nov 15 00:24:46 2011 -0700 @@ -5,7 +5,7 @@ #+SETUPFILE: ../../aurellem/org/setup.org #+INCLUDE: ../../aurellem/org/level-0.org -* Body +* COMMENT Body #+srcname: body-main #+begin_src clojure @@ -112,30 +112,13 @@ for AI control with movement and proprioception." [node] (let [skeleton-control (.getControl node SkeletonControl) - krc (KinematicRagdollControl. (float 0.5))] + krc (KinematicRagdollControl.)] + (comment (dorun (map #(.addBoneName krc %) - ["mid1" "mid2" "mid3" "tail" "head"] - ;; ["Ulna.L" - ;; "Ulna.R" - ;; "Chest" - ;; "Foot.L" - ;; "Foot.R" - ;; "Hand.R" - ;; "Hand.L" - ;; "Neck" - ;; "Root" - ;; "Stomach" - ;; "Waist" - ;; "Humerus.L" - ;; "Humerus.R" - ;; "Thigh.L" - ;; "Thigh.R" - ;; "Calf.L" - ;; "Calf.R" - ;; "Clavicle.L" - ;; "Clavicle.R"] - )) + ["mid2" "tail" "head" "mid1" "mid3" "mid4" "Dummy-Root" ""] + ;;"mid2" "mid3" "tail" "head"] + ))) @@ -152,21 +135,16 @@ (-> (.getAdditionalRenderState) (.setDepthTest false)))) -(defn view-skeleton [node] +(defn show-skeleton [node] (let [sd (doto (SkeletonDebugger. "aurellem-skel-debug" (skel node)) (.setMaterial (green-x-ray)))] - (view (doto (Node. "view node") - (.attachChild sd) + (.attachChild node sd) + node)) - - - - ;;(.attachChild node) - )))) (defn init-debug-skel-node @@ -193,13 +171,40 @@ (import jme3test.bullet.PhysicsTestHelper) + +(defn test-zzz [the-worm world value] + (if (not value) + (let [skeleton (skel the-worm)] + (println-repl "enabling bones") + (dorun + (map + #(.setUserControl (.getBone skeleton %) true) + (range (.getBoneCount skeleton)))) + + + (let [b (.getBone skeleton 6)] + (println-repl "moving " (.getName b)) + (println-repl (.getLocalPosition b)) + (.setUserTransforms b + (.add (.getLocalPosition b) Vector3f/UNIT_X) + Quaternion/IDENTITY + (Vector3f. 1 1 1)) + + ) + + + + (println-repl "hi! <3")))) + + (defn test-ragdoll [] (let [the-worm - (body + ;;(.loadModel (asset-manager) "Models/anim2/Cube.mesh.xml") - ;;(worm-blender) - (worm) + (doto (show-skeleton (worm-blender)) + (.setLocalTranslation (Vector3f. 0 10 0)) + ;;(worm) ;;(oto) ;;(sinbad) ) @@ -210,7 +215,9 @@ (world (doto (Node.) (.attachChild the-worm)) - {"mouse-left" (fire-cannon-ball)} + {"key-return" (fire-cannon-ball) + "key-space" (partial test-zzz the-worm) + } (fn [world] (light-up-everything world) (PhysicsTestHelper/createPhysicsTestWorld @@ -218,6 +225,7 @@ (asset-manager) (.getPhysicsSpace (.getState (.getStateManager world) BulletAppState))) + (set-gravity world Vector3f/ZERO) ;;(.setTimer world (NanoTimer.)) ;;(org.lwjgl.input.Mouse/setGrabbed false) )