comparison org/test-creature.org @ 84:4f5e2c629e45

going to try to fix cone-joint generating code
author Robert McIntyre <rlm@mit.edu>
date Sat, 07 Jan 2012 01:10:14 -0700
parents 14b604e955ed
children 00ab1f10266f
comparison
equal deleted inserted replaced
83:14b604e955ed 84:4f5e2c629e45
51 (rlm.rlm-commands/help) 51 (rlm.rlm-commands/help)
52 52
53 (declare joint-create get-subjective-position) 53 (declare joint-create get-subjective-position)
54 54
55 (defn load-bullet [] 55 (defn load-bullet []
56 (.start (world (Node.) {} no-op no-op))) 56 (let [sim (world (Node.) {} no-op no-op)]
57 (.enqueue
58 sim
59 (fn []
60 (.stop sim)))
61 (.start sim)))
57 62
58 (defn load-blender-model 63 (defn load-blender-model
59 "Load a .blend file using an asset folder relative path." 64 "Load a .blend file using an asset folder relative path."
60 [^String model] 65 [^String model]
61 (.loadModel 66 (.loadModel
307 no-op))) 312 no-op)))
308 313
309 (defn world-setup [joint] 314 (defn world-setup [joint]
310 (let [ 315 (let [
311 316
312 joint-position (Vector3f. 0 4 0) 317 joint-position (Vector3f. 0 0 0)
313 joint-rotation 318 joint-rotation
314 (.toRotationMatrix 319 (.toRotationMatrix
315 (.mult 320 (.mult
316 (doto (Quaternion.) 321 (doto (Quaternion.)
317 (.fromAngleAxis 322 (.fromAngleAxis
318 (* 1 (/ Math/PI 4)) 323 (* 1 (/ Math/PI 4))
319 (Vector3f. -1 0 0))) 324 (Vector3f. 0 0 1)))
320 (doto (Quaternion.) 325 (.mult
321 (.fromAngleAxis 326 (doto (Quaternion.)
322 (/ Math/PI 2) 327 (.fromAngleAxis
323 (Vector3f. 0 0 1))))) 328 (* 2 (/ Math/PI 4))
329 (Vector3f. 0 1 0)))
330 (doto (Quaternion.)
331 (.fromAngleAxis
332 (* 1 (/ Math/PI 2))
333 (Vector3f. 0 0 1))))))
334 top-position (.mult joint-rotation (Vector3f. 8 0 0))
324 335
325 origin (doto 336 origin (doto
326 (sphere 0.1 :physical? false :color ColorRGBA/Cyan 337 (sphere 0.1 :physical? false :color ColorRGBA/Cyan
327 :position (Vector3f. 0 0 0))) 338 :position top-position))
328 top (doto 339 top (doto
329 (sphere 0.1 :physical? false :color ColorRGBA/Yellow 340 (sphere 0.1 :physical? false :color ColorRGBA/Yellow
330 :position (.mult joint-rotation (Vector3f. 8 0 0))) 341 :position top-position)
331 342
332 (.addControl 343 (.addControl
333 (RigidBodyControl. 344 (RigidBodyControl.
334 (CapsuleCollisionShape. 0.5 1.5 1) (float 20)))) 345 (CapsuleCollisionShape. 0.5 1.5 1) (float 20))))
335 bottom (doto 346 bottom (doto