Camera behind a moving object (tomb raider style)

Blitz3D Forums/Blitz3D Programming/Camera behind a moving object (tomb raider style)

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

I would do something like this:
all floats
x=entityx(player)+sin(entityyaw(player)+180)*10
y=entityy(player)+4
z=entityz(player)+cos(entityyaw(player)+180)*10
xc=entityx(camera)
yc=entityy(camera)
zc=entityz(camera)
xc=(xc+(x-xc))/5
yc=(yc+(y-yc))/5
zc=(zc+(z-zc))/5

positionentity camera,xc,yc,zc
pointentity camera,player
while (camerapick(graphicswidth()/2,graphicsheight()/2)<> player) and (entitydistance(camera,player)>2)
 moveentity camera,0,0,.5
 positionentity camera,entityx(camera),entityy(player)+4,entityz(camera)
 pointentity camera,player
wend
...