I did something like this. Hope it helps.
If MouseZSpeed()<>0 Then
speed#=(MouseZ()+MouseZSpeed())*.1
EndIf
;Graphics3D 640,480
Graphics3D 800,600
AutoMidHandle True
;SetBuffer FrontBuffer()
grid_tex=CreateTexture( 32,32,8 )
ScaleTexture grid_tex,10,10
SetBuffer TextureBuffer( grid_tex )
Color 0,0,64:Rect 0,0,32,32
Color 0,0,255:Rect 0,0,32,32,False
SetBuffer BackBuffer()
plane=CreateTerrain(128)
EntityTexture plane,grid_tex
PositionEntity plane,-64,0,0
light1=CreateLight()
PositionEntity light1,-15,15,-15
light2=CreateLight(3)
LightConeAngles light2,5,30
LightColor light2,255,100,100
PositionEntity light2,100,15,100
;***********************************************************
;sets up the player stuff p_pivot= control point
;player= a cube for the player mesh, p_cam=the players
;camera attatched to the player control point.
p_pivot=CreatePivot()
player=CreateCube(p_pivot)
EntityColor player,200,0,0
ScaleEntity player,1,.5,1
p_cam=CreateCamera(p_pivot)
PositionEntity player,0,.55,0
PositionEntity p_pivot,0,0,4
PositionEntity p_cam,0,4,-10
gun=CreateCylinder(16,1,player)
RotateEntity gun,90,0,0
PositionEntity gun,0,0,1
ScaleEntity gun,.5,1,.5
;***********************************************************
Type buttons
Field x
Field y
Field length
Field height
Field image
Field mesage$
End Type
Global rotate.buttons = New buttons
;use this code To relocate the rotation graph down Or change rotatex\rotatey anywhere you want
;rotate\x = GraphicsWidth()/2
;rotate\y = GraphicsHeight()/2+(GraphicsHeight()/3)
rotate\x = GraphicsWidth()/2
rotate\y = GraphicsHeight()/2
rotate\length = 130
rotate\height = 130
rotate\image = CreateImage(rotate\length,rotate\height)
rotate\mesage$ = "Ship Rotation"
SetBuffer ImageBuffer(rotate\image)
Color 100,100,255
Oval 0,0,rotate\length,rotate\height,0
;message$
Text 0,0,rotate\mesage$
Global player_point=CreateImage(20,20)
SetBuffer ImageBuffer(player_point)
Color 0,0,250
Line 10,1,1,20
Color 0,0,250
Line 10,1,20,20
Color 200,0,0
Line 1,19,20,19
;pointrotation data____________________________________________________________________________________
Dim point(359); dimention the array to accomidate the rotations.
For loop=0 To 359
point(loop)=CopyImage(player_point)
MidHandle point(loop)
RotateImage point(loop),loop
DebugLog loop
Next
Global angle#
;make the imiges to be used for the mouse ,mouseimage is the triangle but just a dot for collision
mouseimage=CreateImage(20,20)
mousepoint=CreateImage(2,2)
makemouse(mouseimage,mousepoint)
speed#=0
mode=1
m=1
ClsColor 100,100,100
CameraViewport p_cam,0,0,GraphicsWidth(),500
CameraClsColor p_cam,10,10,100
SetBuffer BackBuffer()
While Not KeyHit(1)
PointEntity light2,plane
p_angle#=-angle#
;If KeyHit(2) mode=mode+1
;If mode=4 Then
;mode=1
;angle#=0
;RotateEntity p_pivot,0,angle#+anglereset#,0
;EndIf
;If mode=1 Then
;PositionEntity p_cam,0,4,-10
RotateEntity p_pivot,0,p_angle#,0
;EndIf
;If mode=2 Then
;RotateEntity player,0,p_angle#,0
;RotateEntity p_pivot,0,p_angle#,0
;EndIf
;If mode=3 Then
;PositionEntity p_cam,0,2,-.5
;RotateEntity player,0,p_angle#,0
;RotateEntity p_pivot,0,p_angle#,0
;EndIf
;***********************************************************
If MouseZSpeed()<>0 Then
speed#=(MouseZ()+MouseZSpeed())*.1
EndIf
MoveEntity p_pivot,0,0,speed#
;***********************************************************
Cls
If KeyHit(57)=True m=m+1
If m=2 Then m=0
If m=1 Then
;Color 255,0,110
;Text 10,500,"angle"+angle
;Text 10,530 ,speed#
;Text 10,550,mode
Color 200,200,100
Text 10,510,"Place the mouse inside the rotation image to rotate cam and player."
Text 10,520,"Hit 1 to change rotation modes. "+"Use the mousewheel to move."
Text 10,530,"Hit space to clear these mesages and gain fps."
;Print "hello world"
EndIf
UpdateWorld()
RenderWorld()
drawhud(mouseimage,mousepoint)
If ImagesOverlap(mousepoint,MouseX(),MouseY(),rotate\image,rotate\x,rotate\y) Then
update_mouse()
EndIf
VWait:Flip
Wend
End
Function drawhud(mouseimage,mousepoint)
DrawImage rotate\image,rotate\x,rotate\y
DrawImage mouseimage,MouseX(),MouseY()
DrawImage mousepoint,MouseX(),MouseY()
DrawImage point(angle),rotate\x,rotate\y
End Function
Function makemouse(mouseimage,mousepoint)
SetBuffer ImageBuffer(mouseimage)
Color 100,60,250
Line 0,0,20,10
Line 0,0,10,20
Line 20,10,10,20
SetBuffer ImageBuffer(mousepoint)
Color 0,255,0
Plot 0,0
HandleImage mouseimage,0,0
HandleImage mousepoint,0,0
End Function
Function update_mouse()
;This code is Thanks to Ross C
;If MouseDown(2) Then
angle=ATan2(rotate\y-MouseY(),rotate\x-MouseX() ) ; the angle between
angle=angle-90 ; subtract 90 from the angle to compinsate for the blitz co-ord system
If angle>359 Then ; check angle is within 0-359 range
angle=angle-359 ; if not, wrap it round
ElseIf angle<0 Then
angle=angle+359
End If
;EndIf
End Function