It seems no matter what I try, the camera view from my conning tower, won't rotate correctly with the uboat model, It seems to have a different pivot point then the model, if ya haven't seen it yet-
and here the uboat model the first view is sittin on-
here's the code (it's a few hundred lines soory)
Rem Project: sea 2
Rem Created: 9/9/2006 5:43:38 PM
Rem ***** Main Source File *****
Set Display Mode 1024,768,32
set text font "book" : set text size 20
set text to bold : set text transparent
sync on : sync rate 0
Load Image "water/waves.bmp", 1
Load Image "water/waves.dds", 2
Load Image "water/refract.bmp", 3
LOAD IMAGE "Images/spec.bmp", 4
LOAD IMAGE "Media/hull.tga",5
LOAD IMAGE "Media/d_gun.tga",6
LOAD IMAGE "Media/prop.tga",7
LOAD IMAGE "Media/20mmflak.tga",8
LOAD IMAGE "Images/spec.bmp", 9
LOAD IMAGE "Images/hud.bmp",10
LOAD IMAGE "Media/torpedo.tga",11
REM SKY OBJECT
Load Object "sky/sky.x", 10
rem objectScale(10, 800)
SCALE OBJECT 10,100000*1000,100000,100000*1000
rem Object Light 10, 1
rem Object Fog 10, 1
Set Object Texture 10, 2, 0
Scale Object Texture 10, 10, 500, 500
Position Object 10, 0, 1000, 0
rem terrain
load object "Media/channelter.x",11
position object 11,0,-1400,0
Set Object Light 11, 1
set object cull 11,0
Set Object Fog 11, 1
rem objects
LOAD OBJECT "Media/hull.X",1
POSITION OBJECT 1,0,3,0
Set Object Light 1, 1
Set Object Fog 1, 1
LOAD OBJECT "Media/dgun_base.X",2
make mesh from object 1, 2
add limb 1, 1, 1
offset limb 1, 1, 0, .47, 16.959662
link limb 1, 0, 1
TEXTURE LIMB 1, 1, 6
LOAD OBJECT "Media/dgun.X",3
make mesh from object 2, 3
add limb 1, 2, 2
offset limb 1,2,0,.74031, 0
link limb 1, 1, 2
TEXTURE LIMB 1, 2, 6
LOAD OBJECT "Media/prop.x",4
make mesh from object 3,4
add limb 1,3,3
offset limb 1,3, 2.19856,-10.307131,-83.868813
link limb 1,0,3
TEXTURE LIMB 1, 3, 7
add limb 1,4,3
offset limb 1,4,-2.47,-10.307131,-83.868813
link limb 1,0,4
TEXTURE LIMB 1, 4, 7
LOAD OBJECT "Media/rudder.x",5
make mesh from object 4,5
add limb 1,5,4
offset limb 1,5,-2,-9.5,-88.99
link limb 1,0,5
TEXTURE LIMB 1, 5, 5
add limb 1,6,4
offset limb 1,6,2,-9.5,-88.99
link limb 1,0,6
TEXTURE LIMB 1, 6, 5
LOAD OBJECT "Media/port_dplane.x",6
make mesh from object 5,6
add limb 1,7,5
offset limb 1,7, -6.4476135,-10.094486,69.78912
link limb 1,0,7
TEXTURE LIMB 1, 7, 5
LOAD OBJECT "Media/star_dplane.x",7
make mesh from object 6,7
add limb 1,8,6
offset limb 1,8, 6.8476135,-10.094486,69.78912
link limb 1,0,8
TEXTURE LIMB 1, 8, 5
LOAD OBJECT "Media/20mm_base.x",8
make mesh from object 7,8
add limb 1,9,7
offset limb 1,9,0,8,-9.128900
link limb 1,0,9
TEXTURE LIMB 1, 9, 8
LOAD OBJECT "Media/20mm_gun.x",9
make mesh from object 8,9
add limb 1,10,8
offset limb 1,10,0,9.307491,-9.128906
link limb 1,0,10
TEXTURE LIMB 1, 10, 8
LOAD OBJECT "Media/torpedo.x",1998
LOAD OBJECT "Media/torpedo_prop.x",1999
XROTATE OBJECT 1999,90
make mesh from object 1,1999
add limb 1998,1,1
link limb 1998,0,1
offset limb 1998,1,0,.001373,-7.343774
TEXTURE LIMB 1998, 1, 11
position object 1998,2.139927,-4.648277,80.289895
DELETE OBJECT 2
DELETE OBJECT 2
DELETE OBJECT 3
DELETE OBJECT 4
DELETE OBJECT 5
DELETE OBJECT 6
DELETE OBJECT 7
DELETE OBJECT 8
DELETE OBJECT 9
Load Object "plain.x", 100, 2
rem objectScale(100, 1000)
SCALE OBJECT 100,1000*1000,1000*1000,1000*1000
xRotate Object 100, 90
Position Object 100, 0, 0, 0
Set Object Diffuse 100, Rgb(256,200,128)
rem Set Object Emissive 100, Rgb(128,128,128)
Set Object Specular 100, Rgb(128,128,128)
Set Object Ambience 100, Rgb(128,128,128)
Set Blend Mapping On 100, 1, 2, 3, 24
Set Blend Mapping On 100, 2, 1, 3, 4
Set Blend Mapping On 100, 3, 3, 3, 26
Set Blend Mapping On 100, 4, 2, 11, 24
Set Blend Mapping On 100, 5, 1, 11, 7
Scale Object Texture 100, 0, 500, 500
Scale Object Texture 100, 1, 1000, 1000
Set Object Light 100, 1
Ghost Object On 100, 1
rem Set Object Fog 100, 1
SET OBJECT CULL 100, 0
MAKE FIRE PARTICLES 1, 2, 5000, 0, 0, 0, 1, 10, 1
ROTATE PARTICLES 1, -90, 0, 45
SET PARTICLE EMISSIONS 1, 5000
SET PARTICLE LIFE 1,1000
SET PARTICLE CHAOS 1,0
GHOST PARTICLES ON 1, 4
SET PARTICLE VELOCITY 1, 500
hide particles 1
MAKE FIRE PARTICLES 2, 2, 5000, 0, 0, 0, 1, 10, 1
ROTATE PARTICLES 2, -90, 0, 45
SET PARTICLE EMISSIONS 2, 5000
SET PARTICLE LIFE 2,1000
SET PARTICLE CHAOS 2,0
GHOST PARTICLES ON 2, 4
SET PARTICLE VELOCITY 2, 500
hide particles 2
MAKE FIRE PARTICLES 3, 2, 5000, 0, 0, 0, 1, 10, 1
ROTATE PARTICLES 3, -90, 0, 45
SET PARTICLE EMISSIONS 2, 5000
SET PARTICLE LIFE 3,1000
SET PARTICLE CHAOS 3,0
GHOST PARTICLES ON 3, 4
SET PARTICLE VELOCITY 3, 500
hide particles 3
actcamera#=1000
forw=0
surface=1
spd#=0
leftrudder=0
rightrudder=0
waveup=1
balli#=.01
balld#=.01
DO
rem load media
if loadcycle#<1 then GOSUB _hudload
if loadcycle#<1 then GOSUB _clonetorpedo
loadcycle#=1
rem camera control
if INKEY$()="r" then actcamera#=1000
if INKEY$()="t" and torpedoout=1 then actcamera#=1001
if INKEY$()="y" then actcamera#=1002
if INKEY$()="u" then actcamera#=1003
gosub _camerasetup
camx#=CAMERA POSITION X (actcamera#)
camy#=CAMERA POSITION y (actcamera#)
camz#=CAMERA POSITION z (actcamera#)
hpx#=OBJECT POSITION X(1)
hpy#=OBJECT POSITION Y(1)
hpz#=OBJECT POSITION Z(1)
hullangy#=object angle y (1)
rudder1#=limb angle y (1,5)
rudder2#=limb angle y (1,6)
rudder3#=limb angle y (1,5)
rudder4#=limb angle y (1,6)
propx1#=LIMB POSITION X(1, 3)
propy1#=LIMB POSITION Y(1, 3)
propz1#=LIMB POSITION Z(1, 3)
propx2#=LIMB POSITION X(1, 4)
propy2#=LIMB POSITION Y(1, 4)
propz2#=LIMB POSITION Z(1, 4)
spy#=object position y (100)
spy2#=object position y (100)
spy#=spy#*10
spy2#=spy2#*10
tube1offsetx#=hpx#-2.139927
tube1offsety#=hpy#+4.648277
tube1offsetz#=hpz#-80.289895
for p=tornum# to 2023
position object p,tube1offsetx#,tube1offsety#,tube1offsetz#
YROTATE OBJECT p, hullangy#
next p
if LEFTKEY()>0 then gosub _leftrudder
if RIGHTKEY()>0 then gosub _rightrudder
if INKEY$()="0" then forw=0
if INKEY$()="1" then forw=1
if INKEY$()="2" then forw=2
if INKEY$()="3" then forw=3
if INKEY$()="4" then forw=4
if INKEY$()="5" then forw=5
if INKEY$()="a" then ballinc=1
if INKEY$()="d" then ballinc=2
if INKEY$()="s" then neutralball=1
if SPACEKEY()>0 and tornum#<2024 then gosub _tube1fire
if torpedofired1=1 then GOSUB _torpedoperform
if ballinc=1 and surface=0 then GOSUB _ballinc
if ballinc=2 and surface=0 then GOSUB _balldec
if surface=1 and ballinc=1 then surface=0
if neutralball=1 and surface=0 then GOSUB _neutralball
if forw=0 then GOSUB _allstop
if forw=1 then GOSUB _ahead14
if forw=2 then GOSUB _ahead12
if forw=3 then GOSUB _ahead34
if forw=4 then GOSUB _aheadfull
if forw=5 then GOSUB _aheadflank
if camy#<spy# and actcamera#<>1003 then gosub _underwater
if camy#>spy# then gosub _abovewater
if rudder3#<0 then rightrudder=1 else rightrudder=0
if rudder1#>0 then leftrudder=1 else leftrudder=0
if leftrudder>0 then gosub _leftturn
if rightrudder>0 then gosub _rightturn
if waveup=1 then GOSUB _waveup
if waveup=0 then GOSUB _wavedown
if ballinc=2 and hpy#>spy# then GOSUB _resurface
rem keep skybox over the ship
POSITION OBJECT 10,CAMERA POSITION X(actcamera#),CAMERA POSITION Y(actcamera#),CAMERA POSITION Z(actcamera#)
REM MAKE CLOCKWISE ANGULAR WAKES(optionally just make them stra?ght for a better look)
ang# = WrapValue(ang# + 0.1)
Scroll Object Texture 100, 0, -Sin(ang#)*0.0001, Cos(ang#)*0.0001
Scroll Object Texture 100, 1, 0.0001, 0.0
set cursor 20,675
print "speed->":set cursor 100,675:print spd#
set cursor 20,690
print "POS X->":set cursor 100,690:print camx#
set cursor 20,705
print "POS Y->":set cursor 100,705:print hpy#
set cursor 20,720
print "POS Z->":set cursor 100,720:print camz#
set cursor 100,100: PRINT tube1offsetz#
set cursor 100,115: PRINT hpz#
sync
LOOP
_hudload:
PASTE IMAGE 10,0,650
RETURN
_clonetorpedo:
FOR t=2000 to 2023
clone object t,1998
hide object t
NEXT t
delete object 1998
DELETE OBJECT 1999
tornum#=2000
RETURN
_waveup:
if spy#<8 then move object 100,-.01
if spy#>8 then waveup=0
RETURN
_wavedown:
if spy2#>-8 then move object 100,.01
if spy2#<-8 then waveup=1
RETURN
_leftturn:
if spd#>0 then hullangy#=hullangy#-.02
if spd#>.05 then hullangy#=hullangy#-.04
if spd#>.09 then hullangy#=hullangy#-.09
YROTATE OBJECT 1, hullangy#
RETURN
_rightturn:
if spd#>0 then hullangy#=hullangy#+.02
if spd#>.05 then hullangy#=hullangy#+.04
if spd#>.09 then hullangy#=hullangy#+.09
YROTATE OBJECT 1, hullangy#
RETURN
_leftrudder:
if rudder1#<15 then rudder1#=rudder1#+3
if rudder2#<15 then rudder2#=rudder2#+3
ROTATE LIMB 1,5,0,rudder1#,0
ROTATE LIMB 1,6,0,rudder2#,0
RETURN
_rightrudder:
if rudder3#>-15 then rudder3#=rudder3#-3
if rudder4#>-15 then rudder4#=rudder4#-3
ROTATE LIMB 1,5,0,rudder3#,0
ROTATE LIMB 1,6,0,rudder4#,0
RETURN
_allstop:
if spd#>0 then spd#=spd#-.0002
move object 1, spd#
HIDE PARTICLES 1
HIDE PARTICLES 2
RETURN
_ahead14:
set cursor 50,50
print "ahead 1/4"
if spd#<.4 then spd#=spd#+.0005
if spd#>.4 then spd#=spd#-.0002
MOVE OBJECT 1, spd#
prop1=LIMB ANGLE Z(1, 3)
prop2=LIMB ANGLE Z(1, 4)
prop1=prop1+50
prop2=prop2-50
ROTATE LIMB 1, 3, 0, 0, prop1
ROTATE LIMB 1, 4, 0, 0, prop2
SHOW PARTICLES 1
SHOW PARTICLES 2
SET PARTICLE EMISSIONS 1, 1
SET PARTICLE EMISSIONS 2, 1
POSITION PARTICLES 1,propx1#,propy1#,propz1#-1
POSITION PARTICLES 2,propx2#,propy2#,propz2#-1
RETURN
_ahead12:
set cursor 50,50
print "ahead 1/2"
if spd#<.425 then spd#=spd#+.001
if spd#>.425 then spd#=spd#-.0002
MOVE OBJECT 1, spd#
prop1=LIMB ANGLE Z(1, 3)
prop2=LIMB ANGLE Z(1, 4)
prop1=prop1+60
prop2=prop2-60
ROTATE LIMB 1, 3, 0, 0, prop1
ROTATE LIMB 1, 4, 0, 0, prop2
SHOW PARTICLES 1
SHOW PARTICLES 2
SET PARTICLE EMISSIONS 1, 5
SET PARTICLE EMISSIONS 2, 5
POSITION PARTICLES 1,propx1#,propy1#,propz1#-1
POSITION PARTICLES 2,propx2#,propy2#,propz2#-1
RETURN
_ahead34:
set cursor 50,50
print "ahead 1/4"
if spd#<.475 then spd#=spd#+.002
if spd#>.475 then spd#=spd#-.0002
MOVE OBJECT 1, spd#
prop1=LIMB ANGLE Z(1, 3)
prop2=LIMB ANGLE Z(1, 4)
prop1=prop1+70
prop2=prop2-70
ROTATE LIMB 1, 3, 0, 0, prop1
ROTATE LIMB 1, 4, 0, 0, prop2
SHOW PARTICLES 1
SHOW PARTICLES 2
SET PARTICLE EMISSIONS 1, 8
SET PARTICLE EMISSIONS 2, 8
POSITION PARTICLES 1,propx1#,propy1#,propz1#-1
POSITION PARTICLES 2,propx2#,propy2#,propz2#-1
RETURN
_aheadfull:
set cursor 50,50
print "ahead full"
if spd#<.525 then spd#=spd#+.003
if spd#>.525 then spd#=spd#-.0002
MOVE OBJECT 1, spd#
prop1=LIMB ANGLE Z(1, 3)
prop2=LIMB ANGLE Z(1, 4)
prop1=prop1+75
prop2=prop2-75
ROTATE LIMB 1, 3, 0, 0, prop1
ROTATE LIMB 1, 4, 0, 0, prop2
SHOW PARTICLES 1
SHOW PARTICLES 2
SET PARTICLE EMISSIONS 1, 10
SET PARTICLE EMISSIONS 2, 10
POSITION PARTICLES 1,propx1#,propy1#,propz1#-1
POSITION PARTICLES 2,propx2#,propy2#,propz2#-1
RETURN
_aheadflank:
set cursor 50,50
print "ahead flank"
if spd#<.550 then spd#=spd#+.005
if spd#>.550 then spd#=.550
MOVE OBJECT 1, spd#
prop1=LIMB ANGLE Z(1, 3)
prop2=LIMB ANGLE Z(1, 4)
prop1=prop1+80
prop2=prop2-80
ROTATE LIMB 1, 3, 0, 0, prop1
ROTATE LIMB 1, 4, 0, 0, prop2
SHOW PARTICLES 1
SHOW PARTICLES 2
SET PARTICLE EMISSIONS 1, 15
SET PARTICLE EMISSIONS 2, 15
POSITION PARTICLES 1,propx1#,propy1#,propz1#-1
POSITION PARTICLES 2,propx2#,propy2#,propz2#-1
RETURN
_ballinc:
balli#=balli#+.02
if balli#>.1 then balli#=balli#+.015
MOVE OBJECT DOWN 1,balli#
pitch object down 1, balld/2
set cursor 955,70:print balli#
RETURN
_balldec:
balld#=balld#+.01
if balld#<.1 then balld#=balld#+.025
MOVE OBJECT up 1,balld#
pitch object up 1, balld/2
set cursor 900,50:print balld#
RETURN
_neutralball:
ballinc=0
balldec=0
neutralball=0
RETURN
_resurface:
set cursor 900,70:print "resurface"
hpy#=-15
ballinc=0
balldec=0
surface=1
RETURN
_tube1fire:
torpedofired1=1
torpedoout=1
show object tornum#
if tornum#<2024 then tornum#=tornum#+1
for v=tornum# to 2023
hide object v
next v
torpedot#=timer()
oldtornum#=tornum#-1
RETURN
_torpedoperform:
torpedotnew#=timer()
torpedolife#=torpedotnew#-torpedot#
torpedospd#=2
torpedoposx#=object position x (oldtornum#)
torpedoposy#=object position y (oldtornum#)
torpedoposz#=object position z (oldtornum#)
show particles 3
POSITION PARTICLES 3, torpropposx#,torpropposy#,torpropposz#-5
torpropang#=LIMB ANGLE Z(oldtornum#, 1)
torpropang#=torpropang#+27
rotate limb oldtornum#,1,0,0,torpropang#
torpedodist#=Distance(1,oldtornum#)
if torpedodist#>20 and torpedoposy#<10 then move object down oldtornum#,.03
if torpedolife#<30000 then MOVE OBJECT oldtornum#,torpedospd#
if torpedolife#>30000 then hide particles 3
if torpedolife#>30000 then gosub _newtorpedo
RETURN
_newtorpedo:
DELETE OBJECT oldtornum#
torpedoout=0
torpedofired1=0
RETURN
_camerasetup:
cam1#=CAMERA EXIST(1000)
cam2#=CAMERA EXIST(1001)
cam3#=CAMERA EXIST(1002)
cam4#=CAMERA EXIST(1003)
if actcamera#=1000 then GOSUB _skycamera
if actcamera#=1001 then GOSUB _torpedocamera
if actcamera#=1002 and surface=1 then GOSUB _conncamera
if actcamera#=1003 and surface=1 then GOSUB _deckguncamera
RETURN
_skycamera:
if cam2#=1 then DELETE CAMERA 1001
if cam3#=1 then DELETE CAMERA 1002
if cam4#=1 then DELETE CAMERA 1003
if cam1#=0 then MAKE CAMERA 1000
SET CURRENT CAMERA 1000
SET CAMERA RANGE 1000, .1, 5000000000
SET CAMERA FOV 1000, 50
hpx#=OBJECT POSITION X(1)
hpy#=OBJECT POSITION Y(1)
hpz#=OBJECT POSITION Z(1)
POSITION CAMERA 1000,hpx#+140,hpy#+25,hpz#-140
POINT CAMERA 1000, hpx#,hpy#,hpz#
RETURN
_torpedocamera:
if cam1#=1 then DELETE CAMERA 1000
if cam3#=1 then DELETE CAMERA 1002
if cam4#=1 then DELETE CAMERA 1003
if cam2#=0 then MAKE CAMERA 1001
SET CURRENT CAMERA 1001
SET CAMERA RANGE 1001, .1, 5000000000
SET CAMERA FOV 1001, 50
rem YROTATE CAMERA 1001,180
POSITION CAMERA 1001,torpedoposx#,torpedoposy#,torpedoposz#-25
RETURN
_conncamera:
if cam1#=1 then DELETE CAMERA 1000
if cam2#=1 then DELETE CAMERA 1001
if cam4#=1 then DELETE CAMERA 1003
if cam3#=0 then MAKE CAMERA 1002
SET CURRENT CAMERA 1002
SET CAMERA RANGE 1002, .1, 5000000000
SET CAMERA FOV 1002, 50
POSITION CAMERA 1002,hpx#-2,hpy#+9,hpz#+2
rotate camera 1002, camera angle x(1002),hullangy#,camera angle z(1002)
RETURN
_deckguncamera:
if cam1#=1 then DELETE CAMERA 1000
if cam2#=1 then DELETE CAMERA 1001
if cam3#=1 then DELETE CAMERA 1002
if cam4#=0 then MAKE CAMERA 1003
SET CURRENT CAMERA 1003
SET CAMERA RANGE 1003, .1, 5000000000
SET CAMERA FOV 1003, 50
POSITION CAMERA 1003,hpx#+3,hpy#+3,hpz#+10
RETURN
_underwater:
rem FOG ON
rem FOG COLOR 0, 0, 0
rem FOG DISTANCE 10000
SET AMBIENT LIGHT 0
RETURN
_abovewater:
rem fog off
rem FOG COLOR 128, 128, 128
rem FOG DISTANCE 10000
SET AMBIENT LIGHT 200
RETURN
function Distance(Object1,Object2)
dist#=sqrt((object position x(Object1)-object position x(Object2))^2+(object position y(Object1)-object position y(Object2))^2+(object position z(Object1)-object position z(Object2))^2)
endfunction dist#
function AngleY(Object1,Object2)
angy#=atanfull(object position x(Object2)-object position x(Object1),object position z(Object2)-object position z(Object1))
endfunction angy#
the view code is this, but I posted it all just in case.
_conncamera:
if cam1#=1 then DELETE CAMERA 1000
if cam2#=1 then DELETE CAMERA 1001
if cam4#=1 then DELETE CAMERA 1003
if cam3#=0 then MAKE CAMERA 1002
SET CURRENT CAMERA 1002
SET CAMERA RANGE 1002, .1, 5000000000
SET CAMERA FOV 1002, 50
POSITION CAMERA 1002,hpx#-2,hpy#+9,hpz#+2
rotate camera 1002, camera angle x(1002),hullangy#,camera angle z(1002)
RETURN
Is this a common problem? any ideas would be very helpful, thanks again,
JABBERWOCKY