flame
flame copied to clipboard
Is it possible to make the camera smoothly follow the player?
Problem to solve
The camera's movement is too jerky when it follows the player.
Proposal
It would be great to have a smooth camera movement option with adjustable smoothness parameters.
More information
No response
Other
- [ ] Are you interested in working on a PR for this?
It depends on what the camera is following. If the component it is following moves smoothly, the camera should move smoothly too.
Just set the maxSpeed
argument in camera.follow
to something lower and it will move smoothly.
Just set the
maxSpeed
argument incamera.follow
to something lower and it will move smoothly.
Thank you, I think I understand what you mean. However, unfortunately, setting the speed alone is not enough. If you have used Cinemachine in Unity or the Position Smoothing and Drag properties of the Camera in Godot, you will see that they achieve a very good effect. Similar to the protagonist in a movie, when the player only moves a short distance, the camera remains stationary. However, when the player moves a sufficient distance, the camera will follow the movement and accelerate smoothly linearly like a movie lens, rather than simply following the player's movement exactly.
However, when the player moves a sufficient distance, the camera will follow the movement and accelerate smoothly linearly like a movie lens, rather than simply following the player's movement exactly.
IMO, this can be easily achieved by introducing a follower component which implements these custom following logic. So FollowerComponent tracks Player and camera simply follows the FollowerComponent normally.
It might also be worth it to create a new package similar to cinemachine instead of adding more code to the existing camera.
It might also be worth it to create a new package similar to cinemachine instead of adding more code to the existing camera.
Maybe we should add a curve argument for the movement, I think that should do it too.
The expected camera movement is like this :
https://github.com/flame-engine/flame/assets/46481943/bafd8833-e711-41cb-88c7-f7886c2c790f
I would really appreciate it if this functionality could be implemented either by creating a new package(like unity) or adding a curve argument for the movement (like godot) . Thank you all for your consideration.
I implemented this on Turi by having an invisible position component as constant camera target. Then, by apllying Effects to this component's position (with curves), one can have such effect.
Video for reference: https://twitter.com/i/status/1717496557422141465