Camera Following object to strictly

Blitz3D Forums/Blitz3D Beginners Area/Camera Following object to strictly

Additionaly here's some theory. Instead of having a camera fixed to a certain position relative to the ship, you should use pivot. The camera then has to try to move to the pivots position as good as it gets. There is a very simple algorithm to do that:

cam_x=cam_x + ((piv_x - cam_x)*0.25)

So you see the distance between camera and pivot is divided by 4 (*.25) and added to the current camera position. This means, the camera needs 4 Frames until it reaches the pivots position. Continous motion of the pivot will then result in a smooth lag. You can easily define the lag this way. Of course you do the same with Y and Z, then position the camera at the calculated (aka smoothed or tweened) position every frame.