hedge-dev / HMMCodes

Hedge Mod Manager community codes repository
13 stars 15 forks source link

[Sonic Frontiers] Smooth Camera Doesn't Always Work #140

Open murdocksblock opened 1 month ago

murdocksblock commented 1 month ago

The smooth camera code doesn't seem to get everything. It works on the majority of camera movements, though in some areas (the spring that launches you past the waterfall in Kronos) and the Cyberspace stage 4-2 Speed Highway vertical segment where the camera pans to Sonic to name a few, it does not apply, and the camera movements are still entirely linear.

Ahremic commented 1 month ago

I might give these a look but to my understanding, those are likely cam-anim / "event" cameras. Maybe.

The "smooth camera" code primarily affects camera volume triggers that control transitioning from one camera state to another, by replacing the linear transition (result = t - deltaTime) with a setup that biases towards the start and end of a transition. This method is duplicated and used in 3 places, the volume triggers, the camera transitioning away from the boss cut-in camera (NOT the one that zooms in), and some titan camera events. Note that with the second example, the smooth camera affects the return to normal gameplay from the boss camera--the boss camera itself is an animation, and any linear movement baked into it is not changed with this code.

Because of that, if 4-2 and the waterfall spring use specialized cameras like baked "cam-anim" movement, there's really nothing I can do.

I could try and set up a transition between the current camera and whenever cam-anim is triggered, but that's also incredibly subjective, won't look good in any case where a cam-anim is intentionally a harsh cut, and overall would have to be special-cased. This is something you'd instead see in a mod that overhauls the cameras ~in general,~ which might not be a bad idea considering some cameras in Frontiers were designed with the linear movement in mind. 1-1 is a good example, when you fall from the sky there's a noticeable halt before the camera turns around. "Fixing" that would probably require changing some things at a deeper level, like which camera is being used, etc. (or maybe going into the camera logic to force a camera to "keep going" once it's flagged to transition... but i'm not adding that feature, sorry 😂)

Also worth noting the smooth camera code doesn't work for any of the combat animations either, which are all cam-anim. Transitioning away from the cam-anim states back to normal camera, if I remember right, all have a smooth transition with this code, but the cameras themselves do not have any easing and adding easing would again (likely) require changing the animations themselves.

TLDR I might give this a look, or help out another contributor to find out why this is happening, but no promises. If it turns out those cases are in fact cam-anims, i'll just have to close this issue. Sorry!