making a 'smart' camera

Blitz3D Forums/Blitz3D Programming/making a 'smart' camera

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.

Well it depends on how "smart" you want your camera to be (ie. what exactly you want it to do.) For simply keeping an unobstructed view between the camera and player there are tricks involving the built-in collision detection system to move the camera: detect collisions between the camera and level, then move the camera in to keep a constant distance from the player, and point the camera at the player every frame. For a smarter camera than that (eg. one which moves to ideal camera angles for given areas of a level) you will pretty much need to code AI to control the camera, basically writing a virtual cameraman which moves the camera around. A waypoint system is helpful here; define waypoints (ie. good camera spots) throughout the level and then have the camera drift from waypoint to waypoint as the player moves through the level.

Either way you check the player's location every frame after UpdateWorld (so that collision detection will have already happened) and then have some sort of algorithm which places the camera based on the player's location.

There are some samples in the Code Archives and which came with Blitz3D which demonstrate 3rd person camera control.