Mercurial > cortex
comparison org/test-creature.org @ 153:c95179907951
saving progress
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Fri, 03 Feb 2012 05:59:32 -0700 |
parents | aaacf087504c |
children | bb235258f835 |
comparison
equal
deleted
inserted
replaced
152:c901b17a1f52 | 153:c95179907951 |
---|---|
158 (import java.awt.Dimension) | 158 (import java.awt.Dimension) |
159 (import com.aurellem.capture.RatchetTimer) | 159 (import com.aurellem.capture.RatchetTimer) |
160 (declare joint-create) | 160 (declare joint-create) |
161 (use 'clojure.contrib.def) | 161 (use 'clojure.contrib.def) |
162 | 162 |
163 | |
164 (defn load-bullet [] | |
165 (let [sim (world (Node.) {} no-op no-op)] | |
166 (doto sim | |
167 (.enqueue | |
168 (fn [] | |
169 (.stop sim))) | |
170 (.start)))) | |
171 | |
172 (defn load-blender-model | 163 (defn load-blender-model |
173 "Load a .blend file using an asset folder relative path." | 164 "Load a .blend file using an asset folder relative path." |
174 [^String model] | 165 [^String model] |
175 (.loadModel | 166 (.loadModel |
176 (doto (asset-manager) | 167 (doto (asset-manager) |
182 [#^Vector3f in] | 173 [#^Vector3f in] |
183 (Vector3f. (.getX in) | 174 (Vector3f. (.getX in) |
184 (.getZ in) | 175 (.getZ in) |
185 (- (.getY in)))) | 176 (- (.getY in)))) |
186 | 177 |
187 | |
188 | |
189 | |
190 | |
191 (defn world-to-local | 178 (defn world-to-local |
192 "Convert the world coordinates into coordinates relative to the | 179 "Convert the world coordinates into coordinates relative to the |
193 object (i.e. local coordinates), taking into account the rotation | 180 object (i.e. local coordinates), taking into account the rotation |
194 of object." | 181 of object." |
195 [#^Spatial object world-coordinate] | 182 [#^Spatial object world-coordinate] |
196 (let [out (Vector3f.)] | 183 (.worldToLocal object world-coordinate nil)) |
197 (.worldToLocal object world-coordinate out) out)) | |
198 | 184 |
199 (defn local-to-world | 185 (defn local-to-world |
200 "Convert the local coordinates into coordinates into world relative | 186 "Convert the local coordinates into coordinates into world relative |
201 coordinates" | 187 coordinates" |
202 [#^Spatial object local-coordinate] | 188 [#^Spatial object local-coordinate] |
203 (let [world-coordinate (Vector3f.)] | 189 (.localToWorld object local-coordinate nil)) |
204 (.localToWorld object local-coordinate world-coordinate) | |
205 world-coordinate)) | |
206 | 190 |
207 (defmulti joint-dispatch | 191 (defmulti joint-dispatch |
208 "Translate blender pseudo-joints into real JME joints." | 192 "Translate blender pseudo-joints into real JME joints." |
209 (fn [constraints & _] | 193 (fn [constraints & _] |
210 (:type constraints))) | 194 (:type constraints))) |