diff --git a/engine.lisp b/engine.lisp index fa8a97c..6ad801e 100644 --- a/engine.lisp +++ b/engine.lisp @@ -43,6 +43,9 @@ ((32 64 2) (32 132 2) (32 164 2)) ((0 255 2) (0 255 2) (64 255 2)))) +;; jet shooting up +(defparameter *jet-vertices* + '((0 0 -0.2) (-0.2 0 0.2) (0.2 0 0.2) (0 (0 0.4 1) 0))) (defmethod draw ((object engine-object) time) (if (< (- time (start-time object)) (activation-time object)) ;; hack since times are in templates!!! diff --git a/flight-sim.lisp b/flight-sim.lisp index 4237cd9..58d9954 100644 --- a/flight-sim.lisp +++ b/flight-sim.lisp @@ -189,7 +189,19 @@ :force (make-instance 'force :newtons 10000 :direction (vector 0 0 1)) :body (make-instance 'body - :coords (vector 0 0 1.5)))))) + :coords (vector 0 0 1.5))) + ; yaw (starboard (right) positive) + :pos-yaw + (make-instance 'engine-object + :activation-time 2 + :model (make-instance 'engine-model + :template-vertices *jet-vertices* + :template-colors *thruster-colors* + :faces (make-2d-array 4 3 '((0 1 3) (0 2 1) (0 3 2) (1 2 3))) + :face-colors (make-2d-array 4 3 '((0 1 3) (0 2 1) (0 3 2) (1 2 3)))) + :body (make-instance 'body + :coords (vector +))) ;:engines (list :engines (list :thrust ; (make-instance 'engine-object ; :motion (make-instance 'motion :coords (vector 0 0.5 3.0)) diff --git a/math.lisp b/math.lisp index 428fd9e..60d4442 100644 --- a/math.lisp +++ b/math.lisp @@ -17,7 +17,9 @@ ;; function to determine value lying on start to end taking time duration at now (defun converge (start end duration now) - (float (+ start (* (- end start) (if (eql now 0.0) 0.0 (/ (min now duration) duration)))))) + (if (> now duration) + end + (float (+ start (* (- end start) (if (eql now 0.0) 0.0 (/ (min now duration) duration))))))) ;; returns a real lisp 2d array