Here's a little demo I've done to point you in the right direction... It doesn't do exactly what you want, but it should give you some clues.
As it is only to demonstrate a method of double firing from wing guns, I've only used simple X/Y/Z rotation so it has the gimbal problem.
You can also figure out the first person view too...
Rem Space Shooting Demo
Rem (c) TDK_Man April 2007
Gosub Setup
Do
Gosub Controls
Pitch Object Up 3000,mousemovey()/8
Roll Object Right 3000,mousemovex()/8
Gosub MoveShip
Gosub RotatePlanets
Set Camera To Follow ShipX#,ShipY#,ShipZ#,Object Angle Y(3000),30,ShipY#+5,5,0
Sync
Text 4,0,"Velocity: "+Str$(Speed#)+" "
Loop
End
AddBullet:
Rem Bullet Obj Numbers Start At 5000
For N = 1 To MaxBullets
If FiredBullet(N)=0
FiredBullet(N)=1
BulletLife(N)=100
Make Object Plain 5000+N,1,2
Texture Object 5000+N,5000
Ghost Object On N+5000
XRotate Object N+5000,Object Angle X(3000)
YRotate Object N+5000,Object Angle Y(3000)
ZRotate Object N+5000,Object Angle Z(3000)
If Odd=0
Position Object 5000+N,Bx1#,By1#,Bz1#
Odd=1
Else
Position Object 5000+N,Bx2#,By2#,Bz2#
Odd=0
Endif
Inc BulletCount
Exit
Endif
Next N
Return
MoveBullet:
Rem Bullet Obj Numbers Start At 5000
For N = 1 To MaxBullets
If FiredBullet(N)=1
Move Object N+5000,4+Speed#
BulletLife(N)=BulletLife(N)-1
If BulletLife(N)= 0
FiredBullet(N) = 0
Delete Object 5000+N
Dec BulletCount
Endif
Rem Check For Hit Enemy Here And Deal With It Here
Endif
Next N
Return
RotatePlanets:
For N2=1000 To 1000+NumPlanets-1
YRotate Object N2,WrapValue(Object Angle Y(N2)+0.04)
YRotate Object N2+100,WrapValue(Object Angle Y(N2+100)+0.02)
Next N2
Return
Controls:
Rem Very basic controls - Q-Inc Speed A-Decrease Speed Mouse To Steer LMB To Fire
I$=Inkey$()
If I$="q" Then Inc Speed#,.1: If Speed# > 5.0 Then Speed# = 5.0
If I$="a" Then Dec Speed#,.1: If Speed# < 0.0 Then Speed# = 0.0
If MouseClick()=1 Then Gosub AddBullet
If BulletCount > 0 Then Gosub MoveBullet
Return
MoveShip:
Move Object 3000,Speed#
ShipX#=Object Position X(3000)
ShipY#=Object Position Y(3000)
ShipZ#=Object Position Z(3000)
Bx1#=LIMB POSITION X(3000,1)
By1#=LIMB POSITION Y(3000,1)
Bz1#=LIMB POSITION Z(3000,1)
Bx2#=LIMB POSITION X(3000,2)
By2#=LIMB POSITION Y(3000,2)
Bz2#=LIMB POSITION Z(3000,2)
Position Object 1,ShipX#,ShipY#,ShipZ#: Rem Starsphere moves with ship
Return
MakeSpaceSphere:
Rem Stars Background
Create Bitmap 1,1024,768
CLS 0
For N=1 To 2000
Ink RGB(Rnd(200)+55,Rnd(100)+10,Rnd(100)+155),0
Dot Rnd(512),Rnd(512)
Next N
Blur Bitmap 1,3
For N=1 To 2000
C=Rnd(200)+55
Ink RGB(C,C,C),0
Dot Rnd(512),Rnd(512)
Next N
Get Image 1,0,0,512,512: Rem <<< Add ,1 on the end if running in DBPro
Make Object Sphere 1,1000
Scale Object 1,50000,50000,50000
Texture Object 1,1
Set Object 1,1,1,0: Rem <<< Reverse LAST THREE 0's and 1's if running in DBPro
Set Current Bitmap 0
Delete Bitmap 1
Return
Populate:
Rem Create a few random planets (10)
Create Bitmap 1,640,480
For N=1000 To 1000+NumPlanets-1
Gosub MakePlanets
Next N
Set Current Bitmap 0
Delete Bitmap 1
Return
MakePlanets:
Rem Planet Texture
PType=Rnd(2)+1
Select PType
Case 1
Rem Earth-Type
R=Rnd(0): G=Rnd(80): B=Rnd(100)+155
CLS RGB(R,G,B): Rem Planet base colour (Water)
R=0: G=125: B=0: Rem Land mass
Ink RGB(R,G,B),0
For N2=1 To 500
X=Rnd(256): Y=Rnd(226)+30
Box X,Y,X+10,Y+10
Next N2
EndCase
Case 2
Rem Alien-Type
R=Rnd(100)+50: G=Rnd(100)+50: B=Rnd(100)+50
CLS RGB(R,G,B): Rem Planet base colour (Water)
Inc R,55: Inc G,55: Inc B,55: Rem Slightly lighter land mass
Ink RGB(R,G,B),0
For N2=1 To 500
X=Rnd(256): Y=Rnd(226)+30
Box X,Y,X+10,Y+10
Next N2
EndCase
Case 3
Rem Alien-Type 2
R=Rnd(50)+40: G=Rnd(50)+40: B=Rnd(50)+40
CLS RGB(R,G,B): Rem Planet base colour (Water)
Inc R,25: Inc G,25: Inc B,25: Rem Slightly lighter land mass
Ink RGB(R,G,B),0
For N2=1 To 500
X=Rnd(256): Y=Rnd(226)+30
Box X,Y,X+10,Y+10
Next N2
EndCase
EndSelect
Rem Polar Region North
Ink RGB(250,250,255),0
Box 0,0,256,30
For N2=1 To 2000
X=Rnd(256): Y=Rnd(40)
Box X,Y,X+2,Y+2
Next N2
Rem Polar Region South
Box 0,226,256,256
For N2=1 To 2000
X=Rnd(256): Y=Rnd(40)+226
Box X,Y,X+2,Y+2
Next N2
Rem Remove Texture Seam
For N2=0 To 127
Get Image 100,N2,0,N2+1,256
Paste Image 100,255-N2,0
Next N2
Blur Bitmap 1,4
Get Image N,0,0,256,256
Rem Atmosphere Texture
CLS 0
NumClouds=PType*100
For N2=1 To NumClouds
C=200: X=Rnd(275): Y=Rnd(120)+68: CloudSize=Rnd(10)+1
For N3=1 To CloudSize
Ink RGB(C,C,C),0
Circle X,Y,N3
Dec C,10
Next N3
Ink RGB(255,255,255),0
Box X-1,Y-1,X+2,Y+2
Next N2
Rem Remove Texture Seam
For N2=256 To 127 Step -1
Get Image 1500,N2,0,N2+1,256
Paste Image 1500,255-N2,0
Next N2
Blur Bitmap 1,4
Get Image N+100,0,0,256,256
Rem Planet Sphere Object (Obj Nums 1000 - 1099)
PlanetSize=Rnd(50)+50
Make Object Sphere N,PlanetSize
Texture Object N,N
SET OBJECT N,1,1,1,1,0,1,1: Rem <<< Reverse ALL 0 and 1 FLAGS if running in DBPro
PlanetX=Rnd(10000)-5000
PlanetY=Rnd(10000)-5000
PlanetZ=Rnd(10000)-5000
Position Object N,PlanetX,PlanetY,PlanetZ
Rem Planet Atmosphere Sphere Object (Obj Nums 1100 - 1199)
Make Object Sphere N+100,PlanetSize+(PlanetSize/10.0)
Texture Object N+100,N+100
SET OBJECT N+100,1,0,0,1,0,0,1: Rem <<< Reverse ALL 0 and 1 FLAGS if running in DBPro
Ghost Object On N+100
Position Object N+100,PlanetX,PlanetY,PlanetZ
Return
MakeBullets:
Create Bitmap 1,640,480
CLS 0
C=255
For N2=1 To 64
Ink RGB(C,0,C),0
Circle 64,64,N2
Dec C,4
Next N2
Blur Bitmap 1,2
Get Image 5000,0,0,128,128
Ink RGB(255,255,255),0
Set Current Bitmap 0
Delete Bitmap 1
Return
Setup:
Set Display Mode 800,600,32
Sync On: Sync Rate 0: CLS 0
AutoCam Off
Set Camera Range 1.0,300000.0
Hide Mouse
Set Camera View 0,0,1,1
NumPlanets = 15
MaxBullets = 500: Rem Max number of bullets at any one time
Dim FiredBullet(MaxBullets)
Dim BulletPosX(MaxBullets)
Dim BulletPosY(MaxBullets)
Dim BulletPosZ(MaxBullets)
Dim BulletLife(MaxBullets)
Randomize Timer()
Center Text 400,200,"Please Wait - Creating Space And Planets..."
Gosub MakeSpaceSphere
Gosub Populate
Gosub MakeShip
Gosub MakeBullets
Ink RGB(255,255,255),0
CLS
Center Text 400,200," Done! Press a key..."
Set Camera View 0,0,800,600
Return
MakeShip:
rem ShipX# = 0.0: ShipY# = 0.0: ShipZ# = 0.0
Make Object Box 3000,6,1,2
Make Mesh From Object 1,3000
ADD LIMB 3000, 1, 1: OFFSET LIMB 3000,1,-3.5,-0.5,0.0
ADD LIMB 3000, 2, 1: OFFSET LIMB 3000,2,3.5,-0.5,0.0
Color Object 3000,RGB(50,100,0)
Delete Mesh 1
Return
Q and A are increase and decrease speed, mouse steers and left mouse button fires.
TDK_Man