working to some degree now.
although now im having an odd issue.
code is here:
`My first dbp application ever
`Paul Drage 22/02/2008
`hiding mouse because i can
hide mouse
sync on
`camera setup variables
Camdist# = 35.0
TrackAngle = 0: Rem 0 - Behind, 180 - Front, 90 & 270 - Sides
ReqCamHeight# = 80.0
`load image
`load image "C:Program FilesDark Basic SoftwareDark Basic Professionalmediawater.bmp",1
`setup light
make light 1 : set directional light 1, 90, 90, 0 : show light 1
`make a plain
`make object plain 1, 1000, 1000
`rotate object 1,90,90,0
`texture the plain
`texture object 1,1
Make Matrix 1,500,500,20,20
`make/load an object that will be my character / player
load object "C:Program FilesDark Basic SoftwareDark Basic Professionalmediamodelsmodel.dbo",1
`position the object/player
`position object 1, 0,35,0
Position Object 1,250,Get Ground Height(1,250,250)+25.0,250
`face the character/object in a direction. x(accross hoz) y(vertical) z(front back axis)
`point object 2, 90, 0, 90
`main program loop
do
`just for purposes of programming so i know
`which scancode is which physical keypress
`print scancode()
`get players current xyz for camera follow function
Player_posX=object position x(1)
Player_posY=object position y(1)
Player_posZ=object position z(1)
`forwards and backwards
if keystate (200) = 1 then move object 1, 0.5
if keystate (208) = 1 then move object 1, -0.5
`turn left or right
if keystate (203) = 1 then turn object left 1, 0.5
if keystate (205) = 1 then turn object right 1, 0.5
`point camera Player_posX,Player_posY,Player_posZ
`position camera player_posx+10,player_posy+40,player_posz+10
ObjHeight# = Get Ground Height(1,Player_posX,Player_posZ)
Camheight# = ObjHeight#+ReqCamHeight#
set camera to follow Player_posX,ObjHeight#,Player_posZ,WrapValue(Object Angle Y(1)+TrackAngle),50,Camheight#,10,0
rotate camera 0, 35, WrapValue(Object Angle Y(1)), 0
sync
loop
`wait for a key press then..
`wait key
sorry still some un-needed code in there.
but problem is, camera follows object around the y axis, but if you keep "spinning" then the camera stays where it is for a moment (almost confused) and then latches back onto the y after a while..
[edit-] should i point out my object is quite big - i dont know if its normal as its a big object and the camera might be becoming lazy? //
thanks
Paul