Move dampening logic into PhantomCameraHost #278
Replies: 2 comments 12 replies
-
In addition, the same goes for when implementing the camera shake feature. Offsets resulting from an impulse should only affect the change in |
Beta Was this translation helpful? Give feedback.
-
Jitter will gradually be mitigated as Godot introduces physics interpolation to 2D and 3D — only 2D is close to being officially supported. There's a longer discussion about this in #241 and a PR for 2D Physics interpolation in #294, which is pending changes in the dev branch for Godot 4.3 before being released. The current implementation is a necessary compromise until Godot implements those two feature variants, as it doesn't impede non-physics animations from being jittery. The system was originally damping the movement in the
|
Beta Was this translation helpful? Give feedback.
-
With the jitter introduced in moving from _physics_process to _process, I believe there needs to be a refactor moving dampening logic out of PhantomCamera2D/PhantomCamera3D and into PhantomCameraHost. This is where the tweening logic already is. Dampening parameters can still be associated with each PhantomCamera and read in by PhantomCameraHost in the same way that PhantomCameraTween parameters are currently. PhantomCamera nodes should act as the "setpoint" or the "model" that can be updated asynchronously or during a timestep of the user's choosing, similar to AnimationMixer.callback_mode_process, while Camera3D/Camera2D nodes should act as the "view" and always update in the _process/IDLE timestep.
In addition, all dampening parameters should always be exposed, possibly as a resource similar to PhantomCameraTween and with multiple dampening schemes. In the current system, the typical use-case for FollowMode.THIRD_PERSON doesn't allow for LookAt dampening to be used, because orientation is being set by user input, rather than LookAtMode logic. As for multiple dampening schemes,
class_name PhantomCameraDampener3D extends Resource
can provide an interface likefunc _dampen(input: Transform3D, delta: float) -> Transform3D
and individual dampener implementationsclass_name PhantomCameraSmoothDamp3D extends PhantomCameraDampener3D
can override this interface. (2D and 3D dampener logic will need to be separated.)Beta Was this translation helpful? Give feedback.
All reactions