Created
July 9, 2014 15:45
-
-
Save nasser/e2644c4fa81e77d24cbf to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn PathFollower-Update [^UnityEngine.Component self] | |
(let [t (long (Time/get_time)) | |
tf (float (Time/get_time)) | |
^objects ary (.state self) | |
^object current-pos (aget ary t) | |
^object next-pos (aget ary (+ 1 t)) | |
;; generates fast code because it knows the type of self and trt | |
^System.Type trt UnityEngine.Transform | |
^UnityEngine.Transform transform (.GetComponent self trt)] ; | |
(.set_localPosition transform | |
(Vector3/Lerp | |
current-pos | |
next-pos | |
(- tf t))))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn PathFollower-Update [^UnityEngine.Component self] | |
(let [t (long (Time/get_time)) | |
tf (float (Time/get_time)) | |
^objects ary (.state self) | |
^object current-pos (aget ary t) | |
^object next-pos (aget ary (+ 1 t)) | |
;; generates SLOW reflection code because it DOES NOT know the type of the 2nd parameter, despite the hint | |
^UnityEngine.Transform transform (.GetComponent self ^System.Type UnityEngine.Transform)] | |
(.set_localPosition transform | |
(Vector3/Lerp | |
current-pos | |
next-pos | |
(- tf t))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment