-
-
Notifications
You must be signed in to change notification settings - Fork 115
Refactor FRAMED Follow Mode with Cinemachine-style Screen-Space Framing #622
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…olation handling to PhantomCamera3D and PhantomCameraHost
|
@ramokz i hope this PR can be tested bit more then normal as it replacing the entire Framed logic and it did alot in my opinion but hopefully in the better direction. |
|
Fixes: Note: make sure the follow axis lock in the |
|
@ramokz there were some missing Change that i did not include by mistake now it should fixed as of my last commit (sorry). |
|
Testing it briefly, and it doesn't seem to be moving in the Z-axis as you're moving away or towards it? Stableframed-follow-stable.mp4PRframed-follow-PR.mp4 |
|
@ramokz Make the Follow Axis Lock to Y. |
|
Sorry, I missed that note above. Think it has to be a default setting, or rather be applied to the mode's logic itself without changing the |
never been more true XD. i will be setting it to Y as a default. |
|
i just made it so that if the user changes the Follow mode and the lock is set to none it going to be set to Y (the effect can't be seen if the mode is set to Framed from the start) |
|
Testing this, I think the approach might need to be readjusted. When testing, both the Z and Y index positions yield an unexpected result. Almost as if it pushes the camera away in the Z-axis while it's remaining the same distance away as the target is falling down or, presumably, moving upwards. The stable version is what ought to be happening, minus the camera sticking to the bottom of the dead zone. Think the freezing of the y-axis is partially the culprit in the PR version, as the camera should also be moving vertically as the target leaves the vertical dead zone. But I'm suspecting the inability for the camera to do that means the z position is changed to compensate for the lack of the vertical (y) movement option. Stableframed-follow-z-offset-stable.mp4PRframed-follow-z-offset-PR.mp4 |
|
.
That is correct when I implemented this was the downside of this approach I will try to test if it's possible. |
|
I don’t think this PR should be merged ever. i hate to say these words tbh. |
|
That's okay! You tried, and that's worth a lot still :) The Framed feature is the most complicated feature of the addon, so it was never going to be an easy task to refactor. |

Overview
This PR refactors the FRAMED follow mode in
PhantomCamera3Dto use a Cinemachine-style screen-space framing approach, replacing the old offset-based system. It also adds physics interpolation support for smoother camera behavior.Key Changes
PhantomCamera3D (phantom_camera_3d.gd)
New Framed Follow State Variables:
_framed_depth_ref- Stable depth reference to prevent camera bobbing_framed_output_position- Smoothed output position for corrections_framed_initialized- Tracks whether framed state has been initialized_framed_correction_velocity- Velocity for smooth damping of corrections_framed_smoothed_target- Smoothed target position to filter physics jitter_previous_basis- For rotation change detection_follow_target_has_interpolation- Cached check forget_global_transform_interpolatedsupportNew Helper Functions:
_initialize_framed_state()- Initializes depth reference and output position_calculate_world_per_pixel()- Calculates world units per screen pixel at a given depthreset_framed_state()- Resets framed state (called on teleport, becoming active, or target change)_set_framed_correction_velocity()- Velocity setter for smooth dampingRefactored FRAMED Logic:
project_position()at stable depthPhysics Interpolation Support:
_get_target_position_offset()now usesget_global_transform_interpolated()when available and physics interpolation is enabledState Reset Integration:
teleport_position()now callsreset_framed_state()set_is_active()resets framed state when becoming activeset_follow_target()resets framed state when target changesset_follow_offset()resets framed state when offset changes in FRAMED mode_on_dead_zone_changed()resets framed statePhantomCameraHost (
phantom_camera_host.gd)FRAMED-specific Interpolation Handling:
AUTOinterpolation mode, FRAMED is forced to use_process()(IDLE) instead of_physics_process()the camera host fix is unfortunate in my opinion but if it is not present the Camera will have a weird damping when Going toward or away from the Camera in result of weird limitation of the engine