spaceship movement

Blitz3D Forums/Blitz3D Programming/spaceship movement

hi all,
I'm probably being dumb here, but what's wrong with my code? I want it to pitch, roll and yaw relative to the position of the camera, but it's not doing that...

; Space game

;player ship
Type ship
	Field y
	Field x
	Field z
	Field mx
	Field my
	Field mz
	Field myaw#
	Field yaw#
	Field mpitch#
	Field pitch#
	Field mroll#
	Field roll#
	Field fshields
	Field rshields
	Field hullstrength
	Field speed
End Type

;alien ship
Type alien
	Field y
	Field x
	Field z
	Field mx
	Field my
	Field mz
	Field yaw
	Field pitch
	Field roll
	Field fshields
	Field rshields
	Field hullstrength
	Field speed
End Type


Graphics3D 1024,768,32,1
swidth = GraphicsWidth()
sheight = GraphicsHeight()
myship = CreateSphere()
shipcamera = CreateCamera(myship)
alienship = CreateSphere()
ps.ship = New ship
PositionEntity alienship,0,0,10

SetBuffer BackBuffer()
CameraZoom shipcamera,2
While Not KeyDown(1)

Cls

If KeyDown(200) Then ps\mpitch=ps\mpitch+0.02 Mod 360
If KeyDown(208) Then ps\mpitch=ps\mpitch-0.02 Mod 360
If KeyDown(203) Then ps\mroll=ps\mroll-0.02 Mod 360
If KeyDown(205) Then ps\mroll=ps\mroll+0.02 Mod 360
ps\roll = (ps\roll + ps\mroll) Mod 360
ps\pitch = (ps\pitch + ps\mpitch) Mod 360
ps\yaw = (ps\yaw + ps\myaw) Mod 360
RotateEntity myship,ps\pitch,ps\yaw,ps\roll,True
ps\mpitch=ps\mpitch*0.99
ps\mroll=ps\mroll*0.99
ps\myaw=ps\myaw*0.99

;draw 3d
UpdateWorld()
RenderWorld()

;draw hud
;target cursor
Color 0,200,0
Line (swidth/2)-10,(sheight/2)-10,(swidth/2)-2,(sheight/2)-2
Line (swidth/2)+10,(sheight/2)-10,(swidth/2)+2,(sheight/2)-2
Line (swidth/2)-10,(sheight/2)+10,(swidth/2)-2,(sheight/2)+2
Line (swidth/2)+10,(sheight/2)+10,(swidth/2)+2,(sheight/2)+2
Flip


Wend
End