Skip to content

Conversation

danbolt
Copy link
Contributor

@danbolt danbolt commented May 16, 2025

This change addresses an issue I've been encountering in #535, where I've enabled physics interpolation but still want to process Phantom Camera on idle updates.

To address this, I've added an option called always_process_on_idle, which prevents Phantom Camera from switching to processing on physics updates. I've put this option in the Advanced Settings, as its a bit of a I know what I'm doing™️ button.

Please let me know if there are any edits I should make, or if the logic should be restructured.

@ramokz
Copy link
Owner

ramokz commented May 28, 2025

Related to the comment in the issue for this.

Think it makes more sense to do this as a property in the PCamHost node for usability and flexibility reasons.

It's also a lighter change, as the caller of the get_follow_target_physics_based() method is just the PCamHost. So can effectively skip the entire logic of that method by simply adding a conditional checker around it like mentioned in the issue.

@ramokz
Copy link
Owner

ramokz commented Jun 1, 2025

Feel free to set up the logic for the interpolation_mode mentioned in the issue for this PR; it should be a fairly trivial amount of work.

Otherwise, am happy to add it myself for the next release!

@danbolt
Copy link
Contributor Author

danbolt commented Jun 1, 2025

Hey, I'll have this PR updated within the next day or so.

Thanks for taking the time to read everything over, as well as provide the context with PCamHost. I think the solution you mentioned is much more concise.

@danbolt
Copy link
Contributor Author

danbolt commented Jun 2, 2025

Hi @ramokz, I've just made an update that incorporates the enum. Please let me know if you have any questions.

On your comment about the change being lighter:

It's also a lighter change, as the caller of the get_follow_target_physics_based() method is just the PCamHost. So can effectively skip the entire logic of that method by simply adding a conditional checker around it like mentioned in the issue.

In order to ensure that each Camera's _process/_physics_process is called where appropriate, I used the _physics_interpolation_enabled property and added some getters/setters. If there's a better way of doing this, please let me know.

Copy link
Owner

@ramokz ramokz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Don't think any changes to the phantom_camera_2d.gd or phantom_camera_3d.gd are needed, so think those can be reverted.

Reason being the inclusion of the flag _follow_target_physics_based in the _process and _physics_process were added before the PCamHost was set to call the active PCam from within its _process / _physics_process with the _tween_follower_checker(). Which gets called before the first Camera2D/3D tick happens when it's about to tween to the next PCam. So the physics processes inside phantom_camera_2d.gd / phantom_camera_3d.gd, in practice, do not really do anything.

So am I am likely going to remove the _physics_process call in the phantom_camera_2d.gd / phantom_camera_3d.gd scripts altogether along with the usage of _follow_target_physics_based inside the conditional in the _process as it is effectively not needed anymore.

Don't worry about this for the PR, it's just to provide some context!

@danbolt
Copy link
Contributor Author

danbolt commented Jun 3, 2025

@ramokz I've done the following:

  1. Removed the logic in phantom_camera_2d.gd and phantom_camera_3d.gd
  2. Updated the setter to call _check_pcam_physics

I also double-checked, and this resolves my issues with #535 .

Let me know if you need anything else. 👍

Copy link
Owner

@ramokz ramokz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Thanks for raising the issue and for the PR submission 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants