ok I have it working like this:
sync on : sync rate 30
hide mouse : autocam off
make object cube 1,5
position object 1,0,0,0
make object cube 2,2
position object 2,0,0,-15
position camera 0,2,-20
make object box 3,1,1,4
do
x# = object position X(2)
y# = object position Y(2)
z# = object position Z(2)
cx#= camera position X()
cy#= camera position y()
cz#= camera position z()
rotate camera camera angle x(0)+(mousemovey()/4.0),camera angle y(0)+(mousemovex()/4.0),0
if wrapvalue(camera angle x(0))>40 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,40
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
if keystate(17)=1
move object 2,0.3
endif
if keystate(31)=1
move object 2,-0.3
endif
if keystate(32)=1
move object right 2,0.3
endif
if keystate(30)=1
move object left 2,0.3
endif
position camera x#, y# , z#
move camera -10
yrotate object 2,camera angle y()
sync
text 0,0, "player x= " + str$(x#)
text 0,15, "player y= " + str$(y#)
text 0,30, "player z= " + str$(z#)
text 0,45, "camera postition = " + str$(cx#) + " " + str$(cy#) + " " + str$(cz#)
loop
function positioncameratoplyr()
x#=object position x(2)
y#=object position y(2)
z#=object position z(2)
a#=object angle y(2)
d#=35.0
h#=40.0
s#=4
set camera to follow x#,y#,z#,a#,d#,h#,s#,1
OldCamAngleY# = CameraAngleY#
OldCamAngleX# = CameraAngleX#
oldx# = object position x(2)
oldy# = object position y(2)
oldz# = object position z(2)
endfunction positioncameratoplyr
but I'm pretty sure that this isn't what I wanted, plus the function doesn't seem to be doing anything different or be capable of doing anything different. The over the shoulder cam I am looking for just seems to be out of reach for the moment.
edit:
ok I got it working, fiddling around and it just popped into place. So with this it follows the camera and has a nice smooth bounce back however the turning is jumpy, anyway that can be smoothed out?
but anyway heres the code, also added a sprint feature so that by pressing shift you move faster:
rem TheConnorian
sync on : sync rate 30 : hide mouse : autocam off
make object cube 1,5
position object 1,0,0,0
make object cube 2,3
position object 2,0,0,-20
position camera 0,0,0,-20
make object box 3,1,1,4
do
rotate camera camera angle x(0)+(mousemovey()/4.0),camera angle y(0)+(mousemovex()/4.0),0
if wrapvalue(camera angle x(0))>40 and wrapvalue(camera angle x(0))<180 then xrotate camera 0,40
if wrapvalue(camera angle x(0))>180 and wrapvalue(camera angle x(0))<280 then xrotate camera 0,280
rotate object 2,0,camera angle y(0),0
if keystate(17)=1
move object 2,speed#
endif
if keystate(31)=1
move object 2,-speed#
endif
if keystate(32)=1
move object right 2,speed#
endif
if keystate(30)=1
move object left 2,speed#
endif
if keystate(42)=1
speed#=0.4
endif
if keystate(42)=0
speed#=0.2
endif
x#=object position x(2)
y#=object position y(2)
z#=object position z(2)
a#=object angle y(2)
d#=10.0
h#=5.0
s#=5
set camera to follow 0,x#,y#,z#,a#,d#,h#,s#,1
sync
loop