ramokz / phantom-camera

👻🎥 Control the movement and dynamically tween 2D & 3D cameras. Built for Godot 4. Inspired by Cinemachine.
https://phantom-camera.dev/
MIT License
2.17k stars 71 forks source link

Tweening of FOV/Near/Far properties ends on incorrect values #326

Closed NullShock78 closed 3 months ago

NullShock78 commented 3 months ago

Issue description

When tweening between two PhantomCamera3Ds with different FOV/Near/Far settings, the final values are not equal to the ones defined in the target's Camera3DResource

Steps to reproduce

  1. Have a Camera3D with a PhantomCameraHost, and two PhantomCamera3D nodes with different FOV/Near/Far settings in their Camera3DResources
  2. Activate a tween between the two PhantomCamera3Ds
  3. After the tween finishes, go into the Remote scene tree and compare the FOV/Near/Far values on the Camera3D node to what is defined in the current PhantomCamera3D's Camera3DResource.

(Optional) Minimal reproduction project

No response

ramokz commented 3 months ago

I can't seem to replicate the issue. Would you be able to either share a recording or a minimal reproducible project sample?

Test below:

Camera3DResource for PlayerPCam:

Camera3DResource for ScenePCam:

https://github.com/ramokz/phantom-camera/assets/5159399/188a16e9-7446-4f01-b69f-369869aad626

NullShock78 commented 3 months ago

Uploaded a minimal example project Might be framerate dependent, so max fps is set in the project Edit: attached video

https://github.com/ramokz/phantom-camera/assets/10644255/069797e0-9773-412a-8757-0c00000eed9e

ramokz commented 3 months ago

The issue seems to partially stem from setting the priority in the _ready() of the root node. If you replace the PhantomCameraHost.gd file with the version below, then that should resolve it. It basically boils down to always running the last frame of a tween, which it sometimes skips — likely due to the fluctuating delta value.

phantom_camera_host.gd.zip