added left jet model animation and action

This commit is contained in:
Dan Ballard 2012-06-27 23:09:53 -07:00
parent 75e3aea0ea
commit 527182c71b
2 changed files with 26 additions and 15 deletions

View File

@ -95,5 +95,13 @@
; ((32 64 2) (32 132 2) (32 164 2))
; ((0 255 2) (0 255 2) (64 255 2))))
;(defparameter *jet-vertices*
; '((0 0 -0.2) (-0.2 0 0.2) (0.2 0 0.2) (0 (0 0.4 1) 0)))
(defparameter *left-jet-vertices*
(make-thruster-vertices
(rotate-points (transform-points *3pyramid-points* (vector 0.25 0.25 0.2)) (vector (- (+ (/ pi 2) .5)) 0 .5))
(rotate-points (transform-points *3pyramid-points* (vector 0.25 0.25 0.4)) (vector (- (+ (/ pi 2) .5)) 0 .5))
2))
(defparameter *left-jet-colors*
(make-thruster-colors '(40 40 40) '(255 255 0) '(80 80 80) '(255 255 255) 2))
; (make-thruster-colors '(196 196 196) '(255 255 196) '(196 196 196) '(255 255 255) 2))

View File

@ -65,10 +65,6 @@
(case key
((:sdl-key-w) ; + z
(activate-attachment *self* :thruster (wall-time)))
; (progn
;(setf (aref (acceleration (motion *self*)) 2) (- *acceleration*))
;(engine-start (engine *self*) (wall-time))))
; (activate-engine *self* :thrust)))
; ((:sdl-key-s) ; - z
; (setf (aref (acceleration (motion *self*)) 2) *acceleration*))
@ -78,19 +74,15 @@
; (setf (aref (acceleration (motion *self*)) 0) (- *acceleration*)))
; ((:sdl-key-e) ; + y
; (setf (aref (acceleration (motion *self*)) 1) *acceleration*))
; ((:sdl-key-d) ; - y
; (setf (aref (acceleration (motion *self*)) 1) (- *acceleration*)))
((:sdl-key-d) ; - y
(activate-attachment *self* :left-jet (wall-time)))
(otherwise (format t "~a~%" key))))
(defun thruster-off (key)
(case key
((:sdl-key-w) ; + z
(deactivate-attachment *self* :thruster))
; (progn
; (setf (aref (acceleration (motion *self*)) 2) 0)
; (engine-stop (engine *self*))))
;((:sdl-key-s) ; - z
;((:sdl-key-s) ; - z
; (setf (aref (acceleration (motion *self*)) 2) 0))
;((:sdl-key-q) ; + q
; (setf (aref (acceleration (motion *self*)) 0) 0))
@ -98,8 +90,8 @@
; (setf (aref (acceleration (motion *self*)) 0) 0))
;((:sdl-key-e) ; + e
; (setf (aref (acceleration (motion *self*)) 1) 0))
;((:sdl-key-d) ; - d
; (setf (aref (acceleration (motion *self*)) 1) 0))
((:sdl-key-d) ; - d
(deactivate-attachment *self* :left-jet))
(otherwise (format t "~a~%" key))))
(defun phys-step (time)
@ -190,6 +182,17 @@
:body (make-instance 'body
:coords (vector 0 0 1.5)))
:left-jet
(make-instance 'engine-object
:activation-time 2
:model (make-instance 'engine-model
:template-vertices *left-jet-vertices*
:template-colors *left-jet-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))))
:force (make-instance 'force :newtons 2000 :direction (vector 1 0 0))
:body (make-instance 'body
:coords (vector -.5 .2 0)))
; yaw (starboard (right) positive)
; :pos-yaw
; (make-instance 'engine-object