moving a camera left to right

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

slenkar(Posted 2004) [#1]
Is there an easy way of moving a camera left 45 degrees,back to facing forward then right 45 degrees?

like a security camera


Bot Builder(Posted 2004) [#2]
this should work
RotateEntity entity,0,Sin(millisecs()/10)*45,0 ;the larger the number millisecs is divided by, the faster it goes.



Matty(Posted 2004) [#3]
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



slenkar(Posted 2004) [#4]
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.


Rob Farley(Posted 2004) [#5]
Change matty's one to rotateentity camera,0,camangle+180,0

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


slenkar(Posted 2004) [#6]
thanks it works now