Closed BenjaTK closed 1 week ago
This is great! Thank you for putting this together. Re: code structure, it looks well integrated, so no particular comments!
Do believe that the feature can be very useful for 3D, thinking of top down or side-scrolling projects in 3D environments, and some of the other Follow Modes
, like Framed Follow
. So don't think it needs to be restricted to just 2D and Simple Follow
, however, not super critical to sort out at this point.
Been digging into this feature and general concept a bit further, and I am wondering if there is a need for some additional properties. Mainly thinking of interpolating the Look Ahead
offset changes, so it doesn't snap in a particular direction when you move, but rather gradually eases towards it.
Cinemachine uses something called Look Ahead Time
(float), which, from my understanding, effectively dictates where the target will be X seconds in the future based on that property's value + the target's velocity ((global_position - prevGloPos) / delta
- I think). Effectively, determining the distance of the camera as you move in a given direction, which looks similar to the properties you've added here. In addition to that, they're also using a Look Ahead Smoothing
(float) property, which dictates how gradual the Look Ahead
pushes the camera towards that final distance. My guess is that they're using that value to interpolate to the final Look Ahead
distance.
Don't necessarily know if their way is an optimal way of doing it, but what I like about it is that the Look Ahead
distance is determined by how fast the target moves rather than a specified value. E.g. if a follow target's movement has some degree of acceleration, it will gradually move the camera as the target's velocity increases. I do also like that it won't be affected, at least not directly, by the Follow Damping
. Since it allows someone to have different levels of camera smoothness for Follow
and Look Ahead
, rather than tying the two together.
Think where your existing properties could come in handy, which I don't believe I've seen applied before but could imagine being useful, is to act as multipliers. Given the idea of Look Ahead Time
is based on time + velocity, it means that you would be bound by the properties to affect both axis equally - assuming the velocity between the x/y axes are identical. Whereas a horizontal and vertical parameter could be a potential way to support some additional fine-tuning. Granted, I don't know if it would be an overly desired feature, it at least provides the user some additional control.
Hey! Sorry for being so late, but I don't think I'll be able to work on this for a long bit. If anyone wants to supersede this, go ahead. My coding skills have a limit anyways lol.
No problem at all! Happy to take a stab at it at some point.
Thanks again for starting the feature implementation 🚀
It only works in 2D and in simple mode because I don't think it could be useful for 3D or the other modes but I can try adding them there too. Also I think the damping when it stops is being a bit weird but I saw in the roadmap that was being fixed.
https://github.com/ramokz/phantom-camera/assets/73806216/74a1435e-0697-4d05-a0b9-8d14d496275d
Let me know if everything's okay! Not too used to how the structure of PhantomCamera works but I did my best.