changeset 53:bb24106cbd6a

many problems solved by tightening up the vertex groups in the blender model
author Robert McIntyre <rlm@mit.edu>
date Tue, 15 Nov 2011 00:24:46 -0700
parents 00d0e1639d4b
children 7bc3b22c507b
files assets/Models/anim2/worm3.blend org/body.org
diffstat 2 files changed, 43 insertions(+), 35 deletions(-) [+]
line wrap: on
line diff
     1.1 Binary file assets/Models/anim2/worm3.blend has changed
     2.1 --- a/org/body.org	Mon Nov 14 21:30:23 2011 -0700
     2.2 +++ b/org/body.org	Tue Nov 15 00:24:46 2011 -0700
     2.3 @@ -5,7 +5,7 @@
     2.4  #+SETUPFILE: ../../aurellem/org/setup.org
     2.5  #+INCLUDE: ../../aurellem/org/level-0.org
     2.6  
     2.7 -* Body  
     2.8 +* COMMENT Body  
     2.9  
    2.10  #+srcname: body-main
    2.11  #+begin_src clojure 
    2.12 @@ -112,30 +112,13 @@
    2.13    for AI control with movement and proprioception."
    2.14    [node]
    2.15    (let [skeleton-control (.getControl node SkeletonControl)
    2.16 -        krc (KinematicRagdollControl. (float 0.5))]
    2.17 +        krc (KinematicRagdollControl.)]
    2.18 +    (comment
    2.19      (dorun
    2.20       (map #(.addBoneName krc %)
    2.21 -          ["mid1" "mid2" "mid3" "tail" "head"]
    2.22 -        ;; ["Ulna.L"
    2.23 -        ;;  "Ulna.R"
    2.24 -        ;;  "Chest"
    2.25 -        ;;  "Foot.L"
    2.26 -        ;;  "Foot.R"
    2.27 -        ;;  "Hand.R"
    2.28 -        ;;  "Hand.L"
    2.29 -        ;;  "Neck"
    2.30 -        ;;  "Root"
    2.31 -        ;;  "Stomach"
    2.32 -        ;;  "Waist"
    2.33 -        ;;  "Humerus.L"
    2.34 -        ;;  "Humerus.R"
    2.35 -        ;;  "Thigh.L"
    2.36 -        ;;  "Thigh.R"
    2.37 -        ;;  "Calf.L"
    2.38 -        ;;  "Calf.R"
    2.39 -        ;;  "Clavicle.L"
    2.40 -        ;;  "Clavicle.R"]
    2.41 -        ))
    2.42 +          ["mid2" "tail" "head" "mid1" "mid3" "mid4" "Dummy-Root" ""]
    2.43 +           ;;"mid2" "mid3" "tail" "head"]
    2.44 +        )))
    2.45  
    2.46  
    2.47      
    2.48 @@ -152,21 +135,16 @@
    2.49      (-> (.getAdditionalRenderState)
    2.50          (.setDepthTest false))))
    2.51  
    2.52 -(defn view-skeleton [node]
    2.53 +(defn show-skeleton [node]
    2.54    (let [sd
    2.55  
    2.56          (doto
    2.57              (SkeletonDebugger. "aurellem-skel-debug"
    2.58                                 (skel node))
    2.59            (.setMaterial (green-x-ray)))]
    2.60 -    (view (doto (Node. "view node")
    2.61 -            (.attachChild sd)
    2.62 +    (.attachChild node sd)
    2.63 +    node))
    2.64  
    2.65 -             
    2.66 -             
    2.67 -             
    2.68 -             ;;(.attachChild node)
    2.69 -             ))))
    2.70    
    2.71  
    2.72  (defn init-debug-skel-node
    2.73 @@ -193,13 +171,40 @@
    2.74  
    2.75  (import jme3test.bullet.PhysicsTestHelper)
    2.76  
    2.77 +
    2.78 +(defn test-zzz [the-worm world value]
    2.79 +  (if (not value)
    2.80 +    (let [skeleton (skel the-worm)]
    2.81 +      (println-repl "enabling bones")
    2.82 +      (dorun
    2.83 +       (map
    2.84 +        #(.setUserControl (.getBone skeleton %) true)
    2.85 +        (range (.getBoneCount skeleton))))
    2.86 +
    2.87 +
    2.88 +      (let [b (.getBone skeleton 6)]
    2.89 +        (println-repl "moving " (.getName b))
    2.90 +        (println-repl (.getLocalPosition b))
    2.91 +        (.setUserTransforms b
    2.92 +                            (.add (.getLocalPosition b) Vector3f/UNIT_X)
    2.93 +                            Quaternion/IDENTITY
    2.94 +                            (Vector3f. 1 1 1))
    2.95 +
    2.96 +        )
    2.97 +      
    2.98 +
    2.99 +      
   2.100 +      (println-repl "hi! <3"))))
   2.101 +
   2.102 +
   2.103  (defn test-ragdoll []
   2.104    
   2.105    (let [the-worm
   2.106 -        (body
   2.107 +        
   2.108           ;;(.loadModel (asset-manager) "Models/anim2/Cube.mesh.xml")
   2.109 -         ;;(worm-blender)
   2.110 -         (worm)
   2.111 +         (doto (show-skeleton (worm-blender))
   2.112 +           (.setLocalTranslation (Vector3f. 0 10 0))
   2.113 +         ;;(worm)
   2.114           ;;(oto)
   2.115           ;;(sinbad)
   2.116          )
   2.117 @@ -210,7 +215,9 @@
   2.118       (world
   2.119        (doto (Node.)
   2.120          (.attachChild the-worm))
   2.121 -      {"mouse-left" (fire-cannon-ball)}
   2.122 +      {"key-return" (fire-cannon-ball)
   2.123 +       "key-space" (partial test-zzz the-worm)
   2.124 +       }
   2.125        (fn [world]
   2.126          (light-up-everything world)
   2.127          (PhysicsTestHelper/createPhysicsTestWorld
   2.128 @@ -218,6 +225,7 @@
   2.129           (asset-manager)
   2.130           (.getPhysicsSpace
   2.131            (.getState (.getStateManager world) BulletAppState)))
   2.132 +        (set-gravity world Vector3f/ZERO)
   2.133          ;;(.setTimer world (NanoTimer.))
   2.134          ;;(org.lwjgl.input.Mouse/setGrabbed false)
   2.135          )