Mercurial > cortex
comparison org/cortex.org @ 6:e3c6d1c1cb00
fixing ray casting problem
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sun, 23 Oct 2011 00:17:54 -0700 |
parents | 50c92af2018e |
children | c32f3eb9fdeb |
comparison
equal
deleted
inserted
replaced
5:93ff2b4e7e6a | 6:e3c6d1c1cb00 |
---|---|
2 #+author: Robert McIntyre | 2 #+author: Robert McIntyre |
3 #+email: rlm@mit.edu | 3 #+email: rlm@mit.edu |
4 #+description: Simulating senses for AI research using JMonkeyEngine3 | 4 #+description: Simulating senses for AI research using JMonkeyEngine3 |
5 #+SETUPFILE: ../../aurellem/org/setup.org | 5 #+SETUPFILE: ../../aurellem/org/setup.org |
6 #+INCLUDE: ../../aurellem/org/level-0.org | 6 #+INCLUDE: ../../aurellem/org/level-0.org |
7 | 7 #+babel: :mkdirp yes :noweb yes |
8 | 8 |
9 * Background | 9 * Background |
10 Artificial Intelligence has tried and failed for more than half a | 10 Artificial Intelligence has tried and failed for more than half a |
11 century to produce programs as flexible, creative, and “intelligent” | 11 century to produce programs as flexible, creative, and “intelligent” |
12 as the human mind itself. Clearly, we are still missing some important | 12 as the human mind itself. Clearly, we are still missing some important |
386 (defvar *app-settings* | 386 (defvar *app-settings* |
387 (doto (AppSettings. true) | 387 (doto (AppSettings. true) |
388 (.setFullscreen false) | 388 (.setFullscreen false) |
389 (.setTitle "Aurellem.") | 389 (.setTitle "Aurellem.") |
390 ;; disable 32 bit stuff for now | 390 ;; disable 32 bit stuff for now |
391 (.setAudioRenderer "Send") | 391 ;;(.setAudioRenderer "Send") |
392 ) | 392 ) |
393 "These settings control how the game is displayed on the screen for | 393 "These settings control how the game is displayed on the screen for |
394 debugging purposes. Use binding forms to change this if desired. | 394 debugging purposes. Use binding forms to change this if desired. |
395 Full-screen mode does not work on some computers.") | 395 Full-screen mode does not work on some computers.") |
396 | 396 |
595 (Box. Vector3f/ZERO 0.5 0.5 0.5) | 595 (Box. Vector3f/ZERO 0.5 0.5 0.5) |
596 true)) | 596 true)) |
597 | 597 |
598 (defn make-shape | 598 (defn make-shape |
599 [#^shape-description d] | 599 [#^shape-description d] |
600 (let [mat (Material. (asset-manager) (:material d)) | 600 (let [asset-manager (if (:asset-manager d) (:asset-manager d) (asset-manager)) |
601 mat (Material. asset-manager (:material d)) | |
601 geom (Geometry. (:name d) (:shape d))] | 602 geom (Geometry. (:name d) (:shape d))] |
602 (if (:texture d) | 603 (if (:texture d) |
603 (let [key (TextureKey. (:texture d))] | 604 (let [key (TextureKey. (:texture d))] |
604 (.setGenerateMips key true) | 605 (.setGenerateMips key true) |
605 (.setTexture mat "ColorMap" (.loadTexture (asset-manager) key)))) | 606 (.setTexture mat "ColorMap" (.loadTexture asset-manager key)))) |
606 (if (:color d) (.setColor mat "Color" (:color d))) | 607 (if (:color d) (.setColor mat "Color" (:color d))) |
607 (.setMaterial geom mat) | 608 (.setMaterial geom mat) |
608 (if-let [rotation (:rotation d)] (.rotate geom rotation)) | 609 (if-let [rotation (:rotation d)] (.rotate geom rotation)) |
609 (.setLocalTranslation geom (:position d)) | 610 (.setLocalTranslation geom (:position d)) |
610 (if (:physical? d) | 611 (if (:physical? d) |
611 (let [impact-shape (doto (GImpactCollisionShape. (.getMesh geom)) (.setMargin 0)) | 612 (let [impact-shape (doto (GImpactCollisionShape. |
613 (.getMesh geom)) (.setMargin 0)) | |
612 physics-control (RigidBodyControl. | 614 physics-control (RigidBodyControl. |
613 impact-shape | 615 ;;impact-shape ;; comment to disable |
614 (float (:mass d)))] | 616 (float (:mass d)))] |
615 (.createJmeMesh impact-shape) | 617 (.createJmeMesh impact-shape) |
616 (.addControl geom physics-control) | 618 (.addControl geom physics-control) |
617 ;;(.setSleepingThresholds physics-control (float 0) (float 0)) | 619 ;;(.setSleepingThresholds physics-control (float 0) (float 0)) |
618 (.setFriction physics-control (:friction d)))) | 620 (.setFriction physics-control (:friction d)))) |