Any chase camera other than CCFollow?

Any chase camera other than CCFollow?
0.0 0


CCFollow always keep the targeted node at the center of the screen. I would like to create a camera that is a little bit different from CCFollow.

In general, the player movement is slow and the camera behaves like CCFollow. The player is at the center of the screen. Once the player accelerates forward, it will be a little bit in front of the camera and the camera tried to catch up. When the player stop move, the player slowly goes back to the center of the screen.

The effect could be similar as following video, but in 2D version. ( See the effect when the ship moves forward.

I used CCMoveBy to simulate the effect but the result is not good. If there is any similar effect or suggestions, please let me know. Thank you.


its not hard to make a “soft follow” effect

get the current position of the target and the camera,
then move the camera by the (distance difference) * CONST, where the CONST is a number between 0 ~ 1, you may also adjust your const and factor in delta time to make it independant from frame rate.

for example, your CONST is 0.5, the target moves right 10 points, the camera only moves 5 points, the next frame, the target did not move, the camera will move another 2.5 points towards the target and so on.