moving a camera left to right

Blitz3D Forums/Blitz3D Programming/moving a camera left to right

Is there an easy way of moving a camera left 45 degrees,back to facing forward then right 45 degrees?

like a security camera

this should work
RotateEntity entity,0,Sin(millisecs()/10)*45,0 ;the larger the number millisecs is divided by, the faster it goes.


set the variable CamChangeInAngle to any value other than zero outside your main loop, then do this:
rotateentity camera,0,CamAngle,0
CamAngle=CamAngle+CamChangeInAngle
IF abs(CamAngle)>45 then CamChangeInAngle=CamChangeInAngle*-1


both of the examples work great but I need it to face in the opposite direction -I cant work out how to change the code.

Change matty's one to rotateentity camera,0,camangle+180,0

change botty's one to (sin(millisecs()/10)*45)+180

thanks it works now